summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-06-21 16:45:00 +0200
committerLars Knoll <lars.knoll@nokia.com>2011-06-22 10:46:12 +0200
commit407a6fe79824b722dbc1224a1be29d26b8fdb729 (patch)
treecd7f4b4c638c6f4a168cf00ab83c26821b41ffe1 /src/widgets/kernel
parent4363d836f6a2b245e8e12d1e5eb08db791e95fce (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/widgets/kernel')
-rw-r--r--src/widgets/kernel/qwidget.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 0646983150..a8bd5ca519 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -8297,6 +8297,21 @@ bool QWidget::event(QEvent *event)
inputMethodEvent((QInputMethodEvent *) event);
break;
+ case QEvent::InputMethodQuery:
+ if (testAttribute(Qt::WA_InputMethodEnabled)) {
+ QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event);
+ QVariant v = inputMethodQuery(query->query());
+
+ if (query->query() == Qt::ImMicroFocus) {
+ QRect r = v.toRect();
+ v = QRect(mapToGlobal(r.topLeft()), r.size());
+ }
+
+ query->setValue(v);
+ query->accept();
+ break;
+ }
+
case QEvent::PolishRequest:
ensurePolished();
break;
@@ -9215,6 +9230,8 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
case Qt::ImAnchorPosition:
// Fallback.
return inputMethodQuery(Qt::ImCursorPosition);
+ case Qt::ImHints:
+ return (int)inputMethodHints();
default:
return QVariant();
}