KWayland::Client::TextInput

#include <textinput.h>

Inheritance diagram for KWayland::Client::TextInput:

Classes

struct  DeleteSurroundingText
 

Public Types

enum  ContentHint : uint32_t {
  ContentHint::None = 0, ContentHint::AutoCompletion = 1 << 0, ContentHint::AutoCorrection = 1 << 1, ContentHint::AutoCapitalization = 1 << 2,
  ContentHint::LowerCase = 1 << 3, ContentHint::UpperCase = 1 << 4, ContentHint::TitleCase = 1 << 5, ContentHint::HiddenText = 1 << 6,
  ContentHint::SensitiveData = 1 << 7, ContentHint::Latin = 1 << 8, ContentHint::MultiLine = 1 << 9
}
 
typedef QFlags< ContentHintContentHints
 
enum  ContentPurpose : uint32_t {
  ContentPurpose::Normal, ContentPurpose::Alpha, ContentPurpose::Digits, ContentPurpose::Number,
  ContentPurpose::Phone, ContentPurpose::Url, ContentPurpose::Email, ContentPurpose::Name,
  ContentPurpose::Password, ContentPurpose::Date, ContentPurpose::Time, ContentPurpose::DateTime,
  ContentPurpose::Terminal
}
 
enum  KeyState { Pressed, Released }
 

Signals

void committed ()
 
void composingTextChanged ()
 
void entered ()
 
void inputPanelStateChanged ()
 
void keyEvent (quint32 xkbKeySym, KWayland::Client::TextInput::KeyState state, Qt::KeyboardModifiers modifiers, quint32 time)
 
void languageChanged ()
 
void left ()
 
void textDirectionChanged ()
 

Public Member Functions

qint32 anchorPosition () const
 
QByteArray commitText () const
 
QByteArray composingFallbackText () const
 
QByteArray composingText () const
 
qint32 composingTextCursorPosition () const
 
qint32 cursorPosition () const
 
DeleteSurroundingText deleteSurroundingText () const
 
void disable (Surface *surface)
 
void enable (Surface *surface)
 
SurfaceenteredSurface () const
 
EventQueueeventQueue () const
 
void hideInputPanel ()
 
bool isInputPanelVisible () const
 
bool isValid () const
 
QByteArray language () const
 
void reset ()
 
void setContentType (ContentHints hints, ContentPurpose purpose)
 
void setCursorRectangle (const QRect &rect)
 
void setEventQueue (EventQueue *queue)
 
void setPreferredLanguage (const QString &language)
 
void setSurroundingText (const QString &text, quint32 cursor, quint32 anchor)
 
void showInputPanel ()
 
Qt::LayoutDirection textDirection () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

 TextInput (Private *p, QObject *parent=nullptr)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Protected Attributes

QScopedPointer< Private > d
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

TextInput represents a Wayland interface for text input.

The TextInput allows to have text composed by the Compositor and be sent to the client.

Depending on the interface the TextInputManager got created for this class encapsulates one of the following interfaces:

  • wl_text_input
  • zwp_text_input_v2
Since
5.23

Definition at line 40 of file textinput.h.

Member Enumeration Documentation

ContentHint allows to modify the behavior of the text input.

Enumerator
None 

no special behaviour

AutoCompletion 

suggest word completions

AutoCorrection 

suggest word corrections

AutoCapitalization 

switch to uppercase letters at the start of a sentence

LowerCase 

prefer lowercase letters

UpperCase 

prefer uppercase letters

TitleCase 

prefer casing for titles and headings (can be language dependent)

HiddenText 

characters should be hidden

SensitiveData 

typed text should not be stored

Latin 

just latin characters should be entered

MultiLine 

the text input is multi line

Definition at line 123 of file textinput.h.

The ContentPurpose allows to specify the primary purpose of a text input.

This allows an input method to show special purpose input panels with extra characters or to disallow some characters.

Enumerator
Normal 

default input, allowing all characters

Alpha 

allow only alphabetic characters

Digits 

allow only digits

Number 

input a number (including decimal separator and sign)

Phone 

input a phone number

Url 

input an URL

Email 

input an email address

Name 

input a name of a person

Password 

input a password

Date 

input a date

Time 

input a time

DateTime 

input a date and time

Terminal 

input for a terminal

Definition at line 177 of file textinput.h.

The possible states for a keyEvent.

See also
keyEvent

Definition at line 115 of file textinput.h.

Member Function Documentation

qint32 KWayland::Client::TextInput::anchorPosition ( ) const

The text between anchorPosition and cursorPosition should be selected.

See also
cursorPosition
committed

Definition at line 125 of file textinput.cpp.

void KWayland::Client::TextInput::committed ( )
signal

Emitted when the currently composing text got committed.

The commitText should get inserted at the cursorPosition and the text around deleteSurroundingText should be deleted.

See also
commitText
cursorPosition
anchorPosition
deleteSurroundingText
QByteArray KWayland::Client::TextInput::commitText ( ) const

The commit text to be inserted.

The commit text might be empty if only text should be deleted or the cursor be moved.

See also
cursorPosition
anchorPosition
deleteSurroundingText
committed

Definition at line 140 of file textinput.cpp.

QByteArray KWayland::Client::TextInput::composingFallbackText ( ) const

The fallback text can be used to replace the composingText in some cases (for example when losing focus).

See also
composingText
composingTextChanged

Definition at line 120 of file textinput.cpp.

QByteArray KWayland::Client::TextInput::composingText ( ) const

The currently being composed text around the composingTextCursorPosition.

See also
composingTextCursorPosition
composingTextChanged

Definition at line 115 of file textinput.cpp.

void KWayland::Client::TextInput::composingTextChanged ( )
signal

Emitted whenever the composing text and related states changed.

See also
composingText
composingTextCursorPosition
composingFallbackText
qint32 KWayland::Client::TextInput::composingTextCursorPosition ( ) const

The cursor position inside the composingText (as byte offset) relative to the start of the composingText.

If index is a negative number no cursor is shown.

See also
composingText
composingTextChanged

Definition at line 110 of file textinput.cpp.

qint32 KWayland::Client::TextInput::cursorPosition ( ) const

The cursor position in bytes at which the commitText should be inserted.

See also
committed

Definition at line 130 of file textinput.cpp.

TextInput::DeleteSurroundingText KWayland::Client::TextInput::deleteSurroundingText ( ) const
Returns
The length in bytes which should be deleted around the cursor position
See also
committed

Definition at line 135 of file textinput.cpp.

void KWayland::Client::TextInput::disable ( Surface surface)

Disable text input in a surface (typically when there is no focus on any text entry inside the surface).

See also
enable

Definition at line 60 of file textinput.cpp.

void KWayland::Client::TextInput::enable ( Surface surface)

Enable text input in a surface (usually when a text entry inside of it has focus).

This can be called before or after a surface gets text (or keyboard) focus via the enter event. Text input to a surface is only active when it has the current text (or keyboard) focus and is enabled.

See also
deactivate

Definition at line 55 of file textinput.cpp.

void KWayland::Client::TextInput::entered ( )
signal

Emitted whenever a Surface is focused on this TextInput.

See also
enteredSurface
left
Surface * KWayland::Client::TextInput::enteredSurface ( ) const
Returns
The Surface which has the text input focus on this TextInput.
See also
entered
left

Definition at line 45 of file textinput.cpp.

void KWayland::Client::TextInput::hideInputPanel ( )

Requests input panels (virtual keyboard) to hide.

See also
showInputPanel

Definition at line 70 of file textinput.cpp.

void KWayland::Client::TextInput::inputPanelStateChanged ( )
signal

Emitted whenever the state of the input panel (virtual keyboard changes).

See also
isInputPanelVisible
bool KWayland::Client::TextInput::isInputPanelVisible ( ) const
Returns
whether the input panel (virtual keyboard) is currently visible on the screen
See also
inputPanelStateChanged

Definition at line 50 of file textinput.cpp.

bool KWayland::Client::TextInput::isValid ( ) const
Returns
true if managing a resource.

Definition at line 40 of file textinput.cpp.

void KWayland::Client::TextInput::keyEvent ( quint32  xkbKeySym,
KWayland::Client::TextInput::KeyState  state,
Qt::KeyboardModifiers  modifiers,
quint32  time 
)
signal

Emitted when a key event was sent.

Key events are not used for normal text input operations, but for specific key symbols which are not composable through text.

Parameters
xkbKeySymThe XKB key symbol, not a key code
stateWhether the event represents a press or release event
modifiersThe hold modifiers on this event
timeTimestamp of this event
QByteArray KWayland::Client::TextInput::language ( ) const

The language of the input text.

As long as the server has not emitted the language, the code will be empty.

Returns
a RFC-3066 format language tag in utf-8.
See also
languageChanged

Definition at line 105 of file textinput.cpp.

void KWayland::Client::TextInput::languageChanged ( )
signal

Emitted whenever the language changes.

See also
language
void KWayland::Client::TextInput::left ( )
signal

Emitted whenever a Surface loses the focus on this TextInput.

See also
enteredSurface
entered
void KWayland::Client::TextInput::reset ( )

Should be called by an editor widget when the input state should be reset, for example after the text was changed outside of the normal input method flow.

Definition at line 75 of file textinput.cpp.

void KWayland::Client::TextInput::setContentType ( ContentHints  hints,
ContentPurpose  purpose 
)

Sets the content purpose and content hints.

While the purpose is the basic purpose of an input field, the hints flags allow to modify some of the behavior.

Definition at line 85 of file textinput.cpp.

void KWayland::Client::TextInput::setCursorRectangle ( const QRect rect)

Sets the cursor outline rect in surface local coordinates.

Allows the compositor to e.g. put a window with word suggestions near the cursor.

Definition at line 90 of file textinput.cpp.

void KWayland::Client::TextInput::setPreferredLanguage ( const QString language)

Sets a specific language.

This allows for example a virtual keyboard to show a language specific layout. The language argument is a RFC-3066 format language tag.

Definition at line 95 of file textinput.cpp.

void KWayland::Client::TextInput::setSurroundingText ( const QString text,
quint32  cursor,
quint32  anchor 
)

Sets the plain surrounding text around the input position.

Parameters
textThe text surrounding the cursor position
cursorIndex in the text describing the cursor position
anchorIndex of the selection anchor, if no selection same as cursor

Definition at line 80 of file textinput.cpp.

void KWayland::Client::TextInput::showInputPanel ( )

Requests input panels (virtual keyboard) to show.

See also
hideInputPanel

Definition at line 65 of file textinput.cpp.

Qt::LayoutDirection KWayland::Client::TextInput::textDirection ( ) const

The text direction of input text.

It is mainly needed for showing input cursor on correct side of the editor when there is no input yet done and making sure neutral direction text is laid out properly.

See also
textDirectionChnaged

Definition at line 100 of file textinput.cpp.

void KWayland::Client::TextInput::textDirectionChanged ( )
signal

Emitted whenver the text direction changes.

See also
textDirection

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jul 9 2020 22:49:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.