diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-21 14:59:30 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-22 19:51:42 +0000 |
commit | dfaadb86e888ad10a49303b77c5e0fb540a03874 (patch) | |
tree | 859b127710c21d688f2f0432661f0c0041d2535f /src/imports/platform/qquickplatformfontdialog.cpp | |
parent | aafe27dd091db7560758b727c3e28263d0a2edcd (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/qquickplatformfontdialog.cpp')
-rw-r--r-- | src/imports/platform/qquickplatformfontdialog.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/imports/platform/qquickplatformfontdialog.cpp b/src/imports/platform/qquickplatformfontdialog.cpp index d0bc3e21..7a3ab3d9 100644 --- a/src/imports/platform/qquickplatformfontdialog.cpp +++ b/src/imports/platform/qquickplatformfontdialog.cpp @@ -39,6 +39,10 @@ #include <QtGui/qpa/qplatformtheme.h> #include <QtGui/private/qguiapplication_p.h> +#ifdef QT_WIDGETS_LIB +#include "widgets/qwidgetplatformfontdialog_p.h" +#endif + QT_BEGIN_NAMESPACE /*! @@ -70,13 +74,17 @@ QT_BEGIN_NAMESPACE } \endcode - FontDialog is currently available on the following platforms: + \section2 Availability + + A native platform font 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 @@ QQuickPlatformFontDialog::QQuickPlatformFontDialog(QObject *parent) : QQuickPlatformDialog(parent), m_options(QFontDialogOptions::create()) { QPlatformDialogHelper *dialog = QGuiApplicationPrivate::platformTheme()->createPlatformDialogHelper(QPlatformTheme::FontDialog); +#ifdef QT_WIDGETS_LIB + if (!dialog) + dialog = new QWidgetPlatformFontDialog(this); +#endif if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(dialog)) { connect(fontDialog, &QPlatformFontDialogHelper::currentFontChanged, this, &QQuickPlatformFontDialog::currentFontChanged); connect(fontDialog, &QPlatformFontDialogHelper::fontSelected, this, &QQuickPlatformFontDialog::fontSelected); |