Fix combobox not opening in treeview item delegate editor
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>
Fri, 24 May 2013 18:25:40 +0000 (20:25 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 28 May 2013 07:47:33 +0000 (09:47 +0200)
This is the same fix as for QTBUG-30715, which leads me to think that
we should spend some more time and re-think how QComboBox gets focus.

See also qtbase 3b992f831.

Task-number: QTBUG-31298
Change-Id: I4393af00c8896051e9ed8b5d8af510633106913c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
src/shared/qtpropertybrowser/qtpropertybrowser.cpp

index 495c71c..bd1305f 100644 (file)
@@ -1867,7 +1867,14 @@ QWidget *QtAbstractPropertyBrowser::createEditor(QtProperty *property,
 
     if (!factory)
         return 0;
-    return factory->createEditor(property, parent);
+    QWidget *w = factory->createEditor(property, parent);
+    // Since some editors can be QComboBoxes, and we changed their focus policy in Qt 5
+    // to make them feel more native on Mac, we need to relax the focus policy to something
+    // more permissive to keep the combo box from losing focus, allowing it to stay alive,
+    // when the user clicks on it to show the popup.
+    if (w)
+        w->setFocusPolicy(Qt::WheelFocus);
+    return w;
 }
 
 bool QtAbstractPropertyBrowser::addFactory(QtAbstractPropertyManager *abstractManager,