summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-19 14:56:32 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-24 14:38:56 +0000
commit8e3c6f165b613c92131f2929a2c2c83054ecce72 (patch)
tree5723467509218f230313d681c1a99c8e9cb50347
parent2a3f226e325f3ff8456273444a281349cbbd680f (diff)
Improve debug formatting of QInputMethodQueryEvent
Add more queries, output the query enumeration value and output the hints as flags. Change-Id: Icfc648a8d6e144074455ecebae1b25c3c3e1063e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/gui/kernel/qevent.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index be8ce1a011..50d9bbb2cc 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3761,14 +3761,25 @@ static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)
static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e)
{
+ QDebugStateSaver saver(d);
+ d.noquote();
const Qt::InputMethodQueries queries = e->queries();
d << "QInputMethodQueryEvent(queries=" << showbase << hex << int(queries)
<< noshowbase << dec << ", {";
- for (unsigned mask = 1; mask <= Qt::ImTextAfterCursor; mask<<=1) {
+ for (unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
if (queries & mask) {
- const QVariant value = e->value(static_cast<Qt::InputMethodQuery>(mask));
- if (value.isValid())
- d << '[' << showbase << hex << mask << noshowbase << dec << '=' << value << "],";
+ const Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(mask);
+ const QVariant value = e->value(query);
+ if (value.isValid()) {
+ d << '[';
+ QtDebugUtils::formatQEnum(d, query);
+ d << '=';
+ if (query == Qt::ImHints)
+ QtDebugUtils::formatQFlags(d, Qt::InputMethodHints(value.toInt()));
+ else
+ d << value.toString();
+ d << "],";
+ }
}
}
d << "})";