path: root/src/winmain/qtmain_winrt.cpp
diff options
authorMaurice Kalinowski <>2016-09-06 11:53:41 +0200
committerMaurice Kalinowski <>2016-09-06 12:15:32 +0000
commitcf88d74466cd6506875676ef2557c179d72fe422 (patch)
tree66307f6e3b1918688ae7fb5187532a711b17d9b3 /src/winmain/qtmain_winrt.cpp
parent657c2bfbeceda3faa2c7a76b4ccec6a65a3445a2 (diff)
winrt: Fix file dialog handling for Windows Phone
Windows Phone needs to use activation targets to properly handle the return value of a file dialog. 0f9ca217d0f479756e50459473cad7371f29047c introduced launching an app via different modes, but broke above use- case for Windows Phone. Hence, we first check if a dispatcher exists and use this one to forward the activation. Task-number: QTBUG-54342 Change-Id: If9dd2df9a45e9aa104775530c695325fe6f684f2 Reviewed-by: Oliver Wolff <>
Diffstat (limited to 'src/winmain/qtmain_winrt.cpp')
1 files changed, 8 insertions, 0 deletions
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index 83a7dc800c..e49817ada4 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -198,6 +198,14 @@ public:
HRESULT activatedLaunch(IInspectable *activateArgs) {
+ // Check if an application instance is already running
+ // This is mostly needed for Windows Phone and file pickers
+ QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher();
+ if (dispatcher) {
+ QCoreApplication::postEvent(dispatcher, new QActivationEvent(activateArgs));
+ return S_OK;
+ }
QCoreApplication *app = QCoreApplication::instance();
// Check whether the app already runs