diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-09-08 14:37:22 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-09-08 14:47:39 +0200 |
commit | b002e21d15ec8ecf6455c75055c6ca3112d5f756 (patch) | |
tree | ac7ed8a89a50b4d881bad0f29da9ab5c22cae37c /src/gui/kernel/qevent.cpp | |
parent | 49bb37e05d9b7047a80c93667d43657395bdec73 (diff) |
Change the QInputMethodQueryEvent to be able to query a set of properties
The event now takes a Qt::InputMethodQueries bitfield. Like this the
editor can set all properties in one go on the event instead of
having to process many query events.
Change-Id: Ifd9d7328a9fce0c21625371ec744ea2090e163be
Reviewed-on: http://codereview.qt-project.org/4448
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 8208f6e04a..ea19a0548d 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1787,9 +1787,9 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace The object should call setValue() on the event to fill in the requested data before calling accept(). */ -QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQuery query) +QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries) : QEvent(InputMethodQuery), - m_query(query) + m_queries(queries) { } @@ -1797,6 +1797,27 @@ QInputMethodQueryEvent::~QInputMethodQueryEvent() { } + +void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery q, const QVariant &v) +{ + for (int i = 0; i < m_values.size(); ++i) { + if (m_values.at(i).query == q) { + m_values[i].value = v; + return; + } + } + QueryPair pair = { q, v }; + m_values.append(pair); +} + +QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery q) const +{ + for (int i = 0; i < m_values.size(); ++i) + if (m_values.at(i).query == q) + return m_values.at(i).value; + return QVariant(); +} + /*! \fn Qt::InputMethodQuery QInputMethodQueryEvent::query() const |