55void QInputMethod::setInputItemTransform(
const QTransform &transform)
58 if (d->inputItemTransform == transform)
61 d->inputItemTransform = transform;
62 emit cursorRectangleChanged();
63 emit anchorRectangleChanged();
278void QInputMethod::update(Qt::InputMethodQueries queries)
282 if (queries & Qt::ImEnabled) {
283 QObject *focus =
qApp->focusObject();
284 bool enabled = d->objectAcceptsInputMethod(focus);
285 QPlatformInputContextPrivate::setInputMethodAccepted(enabled);
288 QPlatformInputContext *ic = d->platformInputContext();
292 if (queries & Qt::ImCursorRectangle)
293 emit cursorRectangleChanged();
295 if (queries & (Qt::ImAnchorRectangle))
296 emit anchorRectangleChanged();
298 if (queries & (Qt::ImInputItemClipRectangle))
299 emit inputItemClipRectangleChanged();
362bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object)
364 bool enabled =
false;
368 static const bool supportsHiddenText = platformSupportsHiddenText();
369 QInputMethodQueryEvent query(supportsHiddenText
370 ? Qt::InputMethodQueries(Qt::ImEnabled)
371 : Qt::InputMethodQueries(Qt::ImEnabled | Qt::ImHints));
372 QGuiApplication::sendEvent(object, &query);
373 enabled = query.value(Qt::ImEnabled).toBool();
374 if (enabled && !supportsHiddenText
375 && Qt::InputMethodHints(query.value(Qt::ImHints).toInt()).testFlag(Qt::ImhHiddenText)) {
385QVariant QInputMethod::queryFocusObject(Qt::InputMethodQuery query,
const QVariant &argument)
388 QObject *focusObject =
qGuiApp->focusObject();
392 static const char *signature =
"inputMethodQuery(Qt::InputMethodQuery,QVariant)";
393 const bool newMethodSupported = focusObject->metaObject()->indexOfMethod(signature) != -1;
394 if (newMethodSupported) {
395 const bool ok = QMetaObject::invokeMethod(focusObject,
"inputMethodQuery",
396 Qt::DirectConnection,
397 Q_RETURN_ARG(QVariant, retval),
398 Q_ARG(Qt::InputMethodQuery, query),
399 Q_ARG(QVariant, argument));
401 if (retval.isValid())
408 QInputMethodQueryEvent queryEvent(query);
409 QCoreApplication::sendEvent(focusObject, &queryEvent);
410 return queryEvent.value(query);