summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/winrt/qwinrttheme.cpp
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-07-04 15:24:41 +0300
committerAndrew Knight <andrew.knight@digia.com>2014-07-10 21:37:25 +0200
commit53ed4de02278b17708199891f9b56c6e6e04103b (patch)
treeebe13807ecf5fa350298e84020377b9f1d6f55cc /src/plugins/platforms/winrt/qwinrttheme.cpp
parentfff0844735f704289036a83ed3af87359483e530 (diff)
winrt: Clean up platform message dialog helper
- Remove "Platform" from class name for consistency - Use ComPtr and HRESULT checking where missing - Use UICommand ID class to reduce callback complexity - Use dialog completed callback to fix failed repeated dialog opening These changes have been tested with the QtQuick.Dialogs message dialog example, and all features appear to be working. Note that the WinRT dialog supports a maximum of three buttons, though, and a warning is printed if this number is exceeded. Similarly to Android, the native hooks can be now be disabled by using qputenv("QT_USE_WINRT_NATIVE_DIALOGS", "0"). Task-number: QTBUG-38115 Task-number: QTBUG-39868 Change-Id: I9943c7c11bd640790db68219cefdca1a680e96ec Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Diffstat (limited to 'src/plugins/platforms/winrt/qwinrttheme.cpp')
-rw-r--r--src/plugins/platforms/winrt/qwinrttheme.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp
index 65ed9440b2..f9c2e21676 100644
--- a/src/plugins/platforms/winrt/qwinrttheme.cpp
+++ b/src/plugins/platforms/winrt/qwinrttheme.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
#include "qwinrttheme.h"
-#include "qwinrtplatformmessagedialoghelper.h"
+#include "qwinrtmessagedialoghelper.h"
#include <QtCore/qfunctions_winrt.h>
#include <QtGui/QPalette>
@@ -131,8 +131,11 @@ QWinRTTheme::QWinRTTheme()
bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const
{
+ static bool useNativeDialogs = qEnvironmentVariableIsSet("QT_USE_WINRT_NATIVE_DIALOGS")
+ ? qgetenv("QT_USE_WINRT_NATIVE_DIALOGS").toInt() : true;
+
if (type == MessageDialog)
- return true;
+ return useNativeDialogs;
return false;
}
@@ -140,7 +143,7 @@ QPlatformDialogHelper *QWinRTTheme::createPlatformDialogHelper(DialogType type)
{
switch (type) {
case MessageDialog:
- return new QWinRTPlatformMessageDialogHelper;
+ return new QWinRTMessageDialogHelper(this);
default:
break;
}