aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qquickcanvas.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-10-28 16:15:38 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-01 05:13:05 +0100
commit2a40fa8d3cd40bdce7d8771a15497fd75ee12f52 (patch)
tree33340afb63d5f491c446a66de27741cf281395aa /src/declarative/items/qquickcanvas.cpp
parent6013a61effd7517f4d659902391f89bee29ec3fe (diff)
Workaround windows not gaining focus on mac.
Delaying giving focus to the rootItem until the canvas window gains focus doesn't work if the window never gains focus. So give focus to the rootItem immediately so text input continues to work while QTBUG-22415 is being resolved. Task-number: QTBUG-22409 Change-Id: I1bdb13485219d0c2a2f8bdcb3e0972444e3813f2 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src/declarative/items/qquickcanvas.cpp')
-rw-r--r--src/declarative/items/qquickcanvas.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/declarative/items/qquickcanvas.cpp b/src/declarative/items/qquickcanvas.cpp
index 6df0c65c94..861b11ff36 100644
--- a/src/declarative/items/qquickcanvas.cpp
+++ b/src/declarative/items/qquickcanvas.cpp
@@ -495,6 +495,12 @@ void QQuickCanvasPrivate::init(QQuickCanvas *c)
rootItemPrivate->canvas = q;
rootItemPrivate->flags |= QQuickItem::ItemIsFocusScope;
+ // In the absence of a focus in event on some platforms assume the window will
+ // be activated immediately and set focus on the rootItem
+ // ### Remove when QTBUG-22415 is resolved.
+ //It is important that this call happens after the rootItem has a canvas..
+ rootItem->setFocus(true);
+
bool threaded = !qmlNoThreadedRenderer();
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) {
@@ -633,13 +639,13 @@ void QQuickCanvasPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F
}
if (!(options & DontChangeFocusProperty)) {
- if (item != rootItem || QGuiApplication::focusWindow() == q) {
+// if (item != rootItem || QGuiApplication::focusWindow() == q) { // QTBUG-22415
itemPrivate->focus = true;
changed << item;
- }
+// }
}
- if (newActiveFocusItem && QGuiApplication::focusWindow() == q) {
+ if (newActiveFocusItem && rootItem->hasFocus()) {
activeFocusItem = newActiveFocusItem;
QQuickItemPrivate::get(newActiveFocusItem)->activeFocus = true;