Add new composite Qt::ImQueryInput query

When cursor position or editor text changes many input method query attributes like
cursor rectangle, cursor position, surrounding text, current selection and anchor
position change as well. Checking in text control and editor classes what of those
related attributes have exactly changed before calling the update increases code
complexity unnecessarily for a little benefit. Qt::InputMethodQueries flag can still
be used to optimize more independent cases when attributes change individually, which is
more common for input methods hints, fonts, platform data, maximum length or enabled
attributes.

Change-Id: Ic9eee5f1edb6d33ef6c01d2c9c8ad582100c0150
Reviewed-on: http://codereview.qt-project.org/4739
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Joona Petrell 2011-09-12 21:54:24 +03:00 committed by Qt by Nokia
parent 5926e4041a
commit 5227ca6ffe
2 changed files with 3 additions and 1 deletions

View File

@ -1247,6 +1247,8 @@ public:
ImPreferredLanguage = 0x200,
ImPlatformData = 0x80000000,
ImQueryInput = ImCursorRectangle | ImCursorPosition | ImSurroundingText |
ImCurrentSelection | ImAnchorPosition,
ImQueryAll = 0xffffffff
};
Q_DECLARE_FLAGS(InputMethodQueries, InputMethodQuery)

View File

@ -1594,7 +1594,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons
emit q->cursorPositionChanged();
_q_updateCurrentCharFormatAndSelection();
if (qGuiApp)
qGuiApp->inputPanel()->update(Qt::ImQueryAll);
qGuiApp->inputPanel()->update(Qt::ImQueryInput);
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
if (cursor.position() != oldCursorPos) {