diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-10-16 13:36:13 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-10-28 09:52:01 +0100 |
commit | d916ffa113459574473b7e38c8e18e2e86dc3a0f (patch) | |
tree | 83edda92f4323d2906c8106c321a29542c5c5ac2 | |
parent | 38b908abbe8acbcb8ccff1f1e6cc2781b182a1f3 (diff) | |
download | qtquickcontrols-d916ffa113459574473b7e38c8e18e2e86dc3a0f.tar.gz |
Dialogs: don't use widgets on mobile touch-based platforms
It doesn't make sense to use widget-based dialogs in a QtQuick app
on a mobile platform because widgets are not optimized for touch.
Change-Id: I8659f247eb6e75ca827e8b42a0fb1e7f65dceee1
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r-- | src/dialogs/plugin.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/dialogs/plugin.cpp b/src/dialogs/plugin.cpp index b8ddf35b..1d701cbe 100644 --- a/src/dialogs/plugin.cpp +++ b/src/dialogs/plugin.cpp @@ -50,6 +50,7 @@ #include "qquickdialog_p.h" #include <private/qguiapplication_p.h> #include <qpa/qplatformintegration.h> +#include <QTouchDevice> //#define PURE_QML_ONLY //#define DEBUG_REGISTRATION @@ -186,9 +187,20 @@ protected: Q_UNUSED(widgetsDir) Q_UNUSED(hasTopLevelWindows) #else + bool mobileTouchPlatform = false; +#if defined(Q_OS_IOS) + mobileTouchPlatform = true; +#elif defined(Q_OS_ANDROID) || defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) || defined(Q_OS_WINRT) + foreach (const QTouchDevice *dev, QTouchDevice::devices()) + if (dev->type() == QTouchDevice::TouchScreen) + mobileTouchPlatform = true; +#endif // If there is a qmldir and we have a QApplication instance (as opposed to a - // widget-free QGuiApplication), assume that the widget-based dialog will work. - if (hasTopLevelWindows && widgetsDir.exists("qmldir") && + // widget-free QGuiApplication), and this isn't a mobile touch-based platform, + // assume that the widget-based dialog will work. Otherwise an application developer + // can ensure that widgets are omitted from the deployment to ensure that the widget + // dialogs won't be used. + if (!mobileTouchPlatform && hasTopLevelWindows && widgetsDir.exists("qmldir") && QCoreApplication::instance()->inherits("QApplication")) { QUrl dialogQmlPath = m_useResources ? QUrl(QString("qrc:/QtQuick/Dialogs/Widget%1.qml").arg(qmlName)) : |