diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-06-21 16:45:00 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-06-22 10:46:12 +0200 |
commit | 407a6fe79824b722dbc1224a1be29d26b8fdb729 (patch) | |
tree | cd7f4b4c638c6f4a168cf00ab83c26821b41ffe1 /src/gui/kernel | |
parent | 4363d836f6a2b245e8e12d1e5eb08db791e95fce (diff) |
add QInputMethodQueryEvent
QInputMethodQueryEvent will replace the old
inputMethodHints() and inputMethodQuery() APIs
in QWidget. It has the advantage that it works
nicely with any kind of QObject.
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 47 | ||||
-rw-r--r-- | src/gui/kernel/qevent.h | 16 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 988d70c6ce..9e6a8d6e52 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1755,6 +1755,53 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace \sa replacementStart(), setCommitString() */ + +/*! \class QInputMethodQueryEvent + + This event is sent by the input context to input objects. + + It is used by the + input method to query a set of properties of the object to be + able to support complex input method operations as support for + surrounding text and reconversions. + + query() specifies which property is queried. + + The object should call setValue() on the event to fill in the requested + data before calling accept(). +*/ +QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQuery query) + : QEvent(InputMethodQuery), + m_query(query) +{ +} + +QInputMethodQueryEvent::~QInputMethodQueryEvent() +{ +} + +/*! + \fn Qt::InputMethodQuery QInputMethodQueryEvent::query() const + + returns the type of data queried. +*/ + +/*! + \fn QVariant QInputMethodQueryEvent::value() const + + returns the value set by the receiving object. Mainly used by the input method. + + \sa setValue() +*/ + +/*! + \fn QVariant QInputMethodQueryEvent::setValue() + + Used by the receiving object to set the value requested by query(). + + \sa setValue() +*/ + #ifndef QT_NO_TABLETEVENT /*! diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 809a3d6371..59d50df268 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -427,6 +427,22 @@ private: int replace_from; int replace_length; }; + +class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent +{ +public: + QInputMethodQueryEvent(Qt::InputMethodQuery query); + ~QInputMethodQueryEvent(); + + Qt::InputMethodQuery query() const { return m_query; } + + void setValue(const QVariant &v) { m_value = v; } + QVariant value() const { return m_value; } +private: + Qt::InputMethodQuery m_query; + QVariant m_value; +}; + #endif // QT_NO_INPUTMETHOD #ifndef QT_NO_DRAGANDDROP |