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>
This commit is contained in:
parent
2a3f226e32
commit
8e3c6f165b
@ -3761,14 +3761,25 @@ static inline void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)
|
|||||||
|
|
||||||
static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e)
|
static inline void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e)
|
||||||
{
|
{
|
||||||
|
QDebugStateSaver saver(d);
|
||||||
|
d.noquote();
|
||||||
const Qt::InputMethodQueries queries = e->queries();
|
const Qt::InputMethodQueries queries = e->queries();
|
||||||
d << "QInputMethodQueryEvent(queries=" << showbase << hex << int(queries)
|
d << "QInputMethodQueryEvent(queries=" << showbase << hex << int(queries)
|
||||||
<< noshowbase << dec << ", {";
|
<< noshowbase << dec << ", {";
|
||||||
for (unsigned mask = 1; mask <= Qt::ImTextAfterCursor; mask<<=1) {
|
for (unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
|
||||||
if (queries & mask) {
|
if (queries & mask) {
|
||||||
const QVariant value = e->value(static_cast<Qt::InputMethodQuery>(mask));
|
const Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(mask);
|
||||||
if (value.isValid())
|
const QVariant value = e->value(query);
|
||||||
d << '[' << showbase << hex << mask << noshowbase << dec << '=' << value << "],";
|
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 << "})";
|
d << "})";
|
||||||
|
Loading…
Reference in New Issue
Block a user