summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-09-12 21:54:24 +0300
committerQt by Nokia <qt-info@nokia.com>2011-09-14 21:30:35 +0200
commit5227ca6ffee3afa2e5c5d7450d80a6ebda44470b (patch)
tree0d2ff6a28b880dd3c0725c512987d1f2d874d13a /src
parent5926e4041acd3ca43acc54a28548e577d2f5cede (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnamespace.h2
-rw-r--r--src/gui/text/qtextcontrol.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index a4b9cf1777..43e6176811 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1247,6 +1247,8 @@ public:
ImPreferredLanguage = 0x200,
ImPlatformData = 0x80000000,
+ ImQueryInput = ImCursorRectangle | ImCursorPosition | ImSurroundingText |
+ ImCurrentSelection | ImAnchorPosition,
ImQueryAll = 0xffffffff
};
Q_DECLARE_FLAGS(InputMethodQueries, InputMethodQuery)
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 2faa5e2078..17c8d3cb49 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -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) {