From a80688799250d516eebf8c6b9f881af5fe06b1d6 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Wed, 9 Nov 2011 17:22:40 +0200 Subject: Document QInputMethodQueryEvent class Change-Id: I6e98f9e690b733a06ee165e5b01ab6a5a784791b Reviewed-by: Lars Knoll --- src/gui/kernel/qevent.cpp | 34 ++++++++++++++++++++++++++-------- src/gui/kernel/qevent.h | 4 ++-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 2c0858ae00..0d26268030 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1721,38 +1721,56 @@ void QInputMethodEvent::setTentativeCommitString(const QString &tentativeCommitS able to support complex input method operations as support for surrounding text and reconversions. - query() specifies which property is queried. + queries() specifies which properties are queried. The object should call setValue() on the event to fill in the requested data before calling accept(). */ + +/*! + \fn Qt::InputMethodQueries QInputMethodQueryEvent::queries() const + + Returns the properties queried by the event. + */ + +/*! + Constructs a query event for properties given by \a queries. + */ QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries) : QEvent(InputMethodQuery), m_queries(queries) { } +/*! + \internal + */ QInputMethodQueryEvent::~QInputMethodQueryEvent() { } - -void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery q, const QVariant &v) +/*! + Sets query property to given value. + */ +void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query, const QVariant &value) { for (int i = 0; i < m_values.size(); ++i) { - if (m_values.at(i).query == q) { - m_values[i].value = v; + if (m_values.at(i).query == query) { + m_values[i].value = value; return; } } - QueryPair pair = { q, v }; + QueryPair pair = { query, value }; m_values.append(pair); } -QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery q) const +/*! + Returns value of a query property. + */ +QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const { for (int i = 0; i < m_values.size(); ++i) - if (m_values.at(i).query == q) + if (m_values.at(i).query == query) return m_values.at(i).value; return QVariant(); } diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index aad31a90eb..a79a56b771 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -457,8 +457,8 @@ public: Qt::InputMethodQueries queries() const { return m_queries; } - void setValue(Qt::InputMethodQuery q, const QVariant &v); - QVariant value(Qt::InputMethodQuery q) const; + void setValue(Qt::InputMethodQuery query, const QVariant &value); + QVariant value(Qt::InputMethodQuery query) const; private: Qt::InputMethodQueries m_queries; struct QueryPair { -- cgit v1.2.3