aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2019-10-11 17:24:21 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-10-14 11:31:46 +0000
commit14ab9db519b082f9e8e93b18c03ca8f3845b2610 (patch)
treefd23fa856dc915c5b6d1ef5670c45a7883b18f61
parent0a74ca6f8ccbee4a8b387cba9382c14809720537 (diff)
QmlDesigner: Fix keyboard focus on mac for 3D edit view
We used LSUIElement and QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM to hide the puppet process on macOS. Unfortunately such a process cannot get any keyboard focus. Change-Id: I73ae919a6a2fd5a733e92a37541baccddc135326 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/Info.plist2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp12
2 files changed, 10 insertions, 4 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/Info.plist b/share/qtcreator/qml/qmlpuppet/qml2puppet/Info.plist
index f8d63231ea..c15f81acad 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/Info.plist
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/Info.plist
@@ -28,7 +28,5 @@ be met: https://www.gnu.org/licenses/gpl-3.0.html.</string>
<string>qml2puppet</string>
<key>CFBundleIdentifier</key>
<string>org.qt-project.qtcreator.qml2puppet</string>
- <key>LSUIElement</key>
- <string>1</string>
</dict>
</plist>
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp
index 22460eaf6b..85c8e512d5 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/qml2puppetmain.cpp
@@ -132,8 +132,16 @@ int main(int argc, char *argv[])
// Since we always render text into an FBO, we need to globally disable
// subpixel antialiasing and instead use gray.
qputenv("QSG_DISTANCEFIELD_ANTIALIASING", "gray");
-#ifdef Q_OS_OSX //This keeps qml2puppet from stealing focus
- qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true");
+#ifdef Q_OS_MACOS
+ // We have to parse the arguments before Q[Gui]Application creation
+ // Since the Qt arguments are not filtered out, yet we do not know the position of the argument
+ for (int i = 0; i < argc; ++i) {
+ const char *arg = argv[i];
+ //In previewmode and rendermode we hide the process
+ if (!qstrcmp(arg, "previewmode") || !qstrcmp(arg, "rendermode"))
+ qputenv("QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM", "true");
+ // This keeps qml2puppet from stealing focus
+ }
#endif
//If a style different from Desktop is set we have to use QGuiApplication