CopperSpice API  1.7.2
QInputMethod Class Reference

The QInputMethod class provides access to the active text input method. More...

Inheritance diagram for QInputMethod:
QObject

Public Signals

void animatingChanged ()
 
void cursorRectangleChanged ()
 
void inputDirectionChanged (Qt::LayoutDirection newDirection)
 
void keyboardRectangleChanged ()
 
void localeChanged ()
 
void visibleChanged ()
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void commit ()
 
void hide ()
 
void invokeAction (Action a, int cursorPosition)
 
void reset ()
 
void show ()
 
void update (Qt::InputMethodQueries queries)
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

QRectF cursorRectangle () const
 
Qt::LayoutDirection inputDirection () const
 
QRectF inputItemRectangle () const
 
QTransform inputItemTransform () const
 
bool isAnimating () const
 
bool isVisible () const
 
QRectF keyboardRectangle () const
 
QLocale locale () const
 
void setInputItemRectangle (const QRectF &rect)
 
void setInputItemTransform (const QTransform &transform)
 
void setVisible (bool visible)
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Static Public Methods

static QVariant queryFocusObject (Qt::InputMethodQuery query, QVariant argument)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Properties

 animating
 
 cursorRectangle
 
 inputDirection
 
 keyboardRectangle
 
 locale
 
 visible
 
- Properties inherited from QObject
 objectName
 

Friends

class QApplication
 
class QPlatformInputContext
 

Additional Inherited Members

- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The QInputMethod class provides access to the active text input method. This class is used by the text editors for integrating to the platform text input methods and more commonly by application views for querying various text input method-related information like virtual keyboard visibility and keyboard dimensions.

Method Documentation

void QInputMethod::animatingChanged ( )
signal

This signal is emitted when the value of the animating property is changed.

void QInputMethod::commit ( )
slot

Commits the word user is currently composing to the editor. The method is mostly needed by the input methods with text prediction features and by the methods where the script used for typing characters is different from the script that actually gets appended to the editor. Any kind of action that interrupts the text composing needs to flush the composing state by calling the commit() function, for example when the cursor is moved elsewhere.

QRectF QInputMethod::cursorRectangle ( ) const

Returns the value of the cursorRectangle property.

void QInputMethod::cursorRectangleChanged ( )
signal

This signal is emitted when the value of the cursorRectangle property is changed.

void QInputMethod::hide ( )
slot

Requests virtual keyboard to close. Normally applications should not need to call this function, keyboard should automatically close when the text editor loses focus, for example when the parent view is closed.

Qt::LayoutDirection QInputMethod::inputDirection ( ) const

Returns the value of the inputDirection property.

void QInputMethod::inputDirectionChanged ( Qt::LayoutDirection  newDirection)
signal

This signal is emitted when the value of the inputDirection property is changed.

QRectF QInputMethod::inputItemRectangle ( ) const

Returns the input item's geometry in input item coordinates.

See also
setInputItemRectangle()
QTransform QInputMethod::inputItemTransform ( ) const

Returns the transformation from input item coordinates to the window coordinates.

See also
setInputItemTransform()
void QInputMethod::invokeAction ( Action  a,
int  cursorPosition 
)
slot

Called by the input item when the word currently being composed is tapped by the user, as indicated by the action a and the given cursorPosition. Input methods often use this information to offer more word suggestions to the user.

bool QInputMethod::isAnimating ( ) const

Returns the value of the animating property.

bool QInputMethod::isVisible ( ) const

Returns the value of the visible property.

QRectF QInputMethod::keyboardRectangle ( ) const

Returns the value of the keyboardRectangle property.

void QInputMethod::keyboardRectangleChanged ( )
signal

This signal is emitted when the value of the keyboardRectangle property is changed.

QLocale QInputMethod::locale ( ) const

Returns the value of the locale property.

void QInputMethod::localeChanged ( )
signal

This signal is emitted when the value of the locale property is changed.

QVariant QInputMethod::queryFocusObject ( Qt::InputMethodQuery  query,
QVariant  argument 
)
static

Send query to the current focus object with parameters argument and return the result.

void QInputMethod::reset ( )
slot

Resets the input method state. For example, a text editor normally calls this method before inserting a text to make widget ready to accept a text. The Input method resets automatically when the focused editor changes.

void QInputMethod::setInputItemRectangle ( const QRectF rect)

Sets the input item's geometry to rect in input item coordinates. This needs to be updated by the focused window like QQuickCanvas whenever item is moved inside the scene, or focus is changed.

See also
inputItemRectangle()
void QInputMethod::setInputItemTransform ( const QTransform transform)

Sets the transformation from input item coordinates to window coordinates to transform. Item transform needs to be updated by the focused window like QQuickCanvas whenever item is moved inside the scene.

See also
inputItemTransform()
void QInputMethod::setVisible ( bool  visible)

Controls the keyboard visibility. Equivalent to calling show() if visible is true or hide() if visible is false.

See also
isVisible(), show(), hide()
void QInputMethod::show ( )
slot

Requests virtual keyboard to open. If the platform does not provide virtual keyboard the visibility remains false. Normally applications should not need to call this function, keyboard should automatically open when the text editor gains focus.

void QInputMethod::update ( Qt::InputMethodQueries  queries)
slot

Called by the input item to inform the platform input methods when there has been state changes in editor's input method query attributes. When calling the function queries parameter has to be used to tell what has changes, which input method can use to make queries for attributes it's interested with QInputMethodQueryEvent.

In particular calling update whenever the cursor position changes is important as that often causes other query attributes like surrounding text and text selection to change as well. The attributes that often change together with cursor position have been grouped in Qt::ImQueryInput value for convenience.

void QInputMethod::visibleChanged ( )
signal

This signal is emitted when the value of the visible property is changed.

Property Documentation

QInputMethod::animating

Animating is false when keyboard is fully open or closed. When animating is true and visibility is true keyboard is being opened. When animating is true and visibility is false keyboard is being closed.

PropertiesClass Methods
read isAnimating
notify animatingChanged
QInputMethod::cursorRectangle

Input item's cursor rectangle in window coordinates. Cursor rectangle is often used by various text editing controls like text prediction popups for following the text being typed.

PropertiesClass Methods
read cursorRectangle
notify cursorRectangleChanged
QInputMethod::inputDirection

Current input direction.

PropertiesClass Methods
read inputDirection
notify inputDirectionChanged
QInputMethod::keyboardRectangle

Virtual keyboard's geometry in window coordinates. This might be an empty rectangle if it is not possible to know the geometry of the keyboard.

PropertiesClass Methods
read keyboardRectangle
notify keyboardRectangleChanged
QInputMethod::locale

Current input locale.

PropertiesClass Methods
read locale
notify localeChanged
QInputMethod::visible

Virtual keyboard's visibility on the screen. Input method visibility remains false for devices with no virtual keyboards.

PropertiesClass Methods
read isVisible
notify visibleChanged