Input method support for QQuickWidget
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>
Wed, 10 Dec 2014 14:11:59 +0000 (15:11 +0100)
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>
Thu, 11 Dec 2014 10:58:00 +0000 (11:58 +0100)
Make sure QGuiApplication::focusObject() returns the QQuickItem
that has focus, and forward input method events.

Task-number: QTBUG-42677
Change-Id: Ic07f93a2529c3dde67272b489bdc61fd25582a69
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
src/quickwidgets/qquickwidget.cpp
src/quickwidgets/qquickwidget_p.h

index 83fe586..6143e4e 100644 (file)
@@ -246,6 +246,11 @@ QImage QQuickWidgetPrivate::grabFramebuffer()
     return renderControl->grab();
 }
 
+QObject *QQuickWidgetPrivate::focusObject()
+{
+    return offscreenWindow ? offscreenWindow->focusObject() : 0;
+}
+
 /*!
     \module QtQuickWidgets
     \title Qt Quick Widgets C++ Classes
@@ -1086,6 +1091,9 @@ bool QQuickWidget::event(QEvent *e)
         e->accept();
         return true;
 #endif
+    case QEvent::InputMethod:
+    case QEvent::InputMethodQuery:
+
     case QEvent::TouchBegin:
     case QEvent::TouchEnd:
     case QEvent::TouchUpdate:
index 2ff9601..57782a6 100644 (file)
@@ -81,6 +81,8 @@ public:
     void destroyContext();
     void handleContextCreationFailure(const QSurfaceFormat &format, bool isEs);
 
+    QObject *focusObject() Q_DECL_OVERRIDE;
+
     GLuint textureId() const Q_DECL_OVERRIDE;
     QImage grabFramebuffer() Q_DECL_OVERRIDE;