aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/platform/qquickplatformcolordialog.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-06-21 14:59:30 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-06-22 19:51:42 +0000
commitdfaadb86e888ad10a49303b77c5e0fb540a03874 (patch)
tree859b127710c21d688f2f0432661f0c0041d2535f /src/imports/platform/qquickplatformcolordialog.cpp
parentaafe27dd091db7560758b727c3e28263d0a2edcd (diff)
ColorDialog & FontDialog: use widgets as a fallback
This makes these dialogs available on Windows and KDE. One more reason to keep the module experimental. In the long run, platforms should implement QPA dialogs so that we can remove the undesired dependency. Also simple instance creation tests are included to make sure it won't crash with non-QApplication apps. Change-Id: Ib4dabe7b656a1aa1f114052a3f57c9b1232ff27f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/platform/qquickplatformcolordialog.cpp')
-rw-r--r--src/imports/platform/qquickplatformcolordialog.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/imports/platform/qquickplatformcolordialog.cpp b/src/imports/platform/qquickplatformcolordialog.cpp
index a69ba025..c0cb3691 100644
--- a/src/imports/platform/qquickplatformcolordialog.cpp
+++ b/src/imports/platform/qquickplatformcolordialog.cpp
@@ -39,6 +39,10 @@
#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/private/qguiapplication_p.h>
+#ifdef QT_WIDGETS_LIB
+#include "widgets/qwidgetplatformcolordialog_p.h"
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -70,13 +74,17 @@ QT_BEGIN_NAMESPACE
}
\endcode
- ColorDialog is currently available on the following platforms:
+ \section2 Availability
+
+ A native platform color dialog is currently available on the following platforms:
\list
\li OS X
\li Linux (when running with the GTK+ platform theme)
\endlist
+ \input includes/widgets.qdocinc 1
+
\labs
*/
@@ -92,6 +100,10 @@ QQuickPlatformColorDialog::QQuickPlatformColorDialog(QObject *parent)
: QQuickPlatformDialog(parent), m_options(QColorDialogOptions::create())
{
QPlatformDialogHelper *dialog = QGuiApplicationPrivate::platformTheme()->createPlatformDialogHelper(QPlatformTheme::ColorDialog);
+#ifdef QT_WIDGETS_LIB
+ if (!dialog)
+ dialog = new QWidgetPlatformColorDialog(this);
+#endif
if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(dialog)) {
connect(colorDialog, &QPlatformColorDialogHelper::currentColorChanged, this, &QQuickPlatformColorDialog::currentColorChanged);
connect(colorDialog, &QPlatformColorDialogHelper::colorSelected, this, &QQuickPlatformColorDialog::colorSelected);