summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-02-09 16:33:43 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-02-10 10:37:08 +0000
commit751ca5dfb7c3f0edd76110a5dc3a3696d3e0539c (patch)
treef33e1e29a03331458f0474944e17fe378da5bab0
parent51eff608eb18b01d36fdab442930300a4af3df20 (diff)
Platform: respect the configurable features in Qt Widgetsv5.9.0-alpha1
Change-Id: I4a0696e4f897a378e3944c7948ba00e5f2038f5d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/imports/platform/widgets/qwidgetplatform_p.h49
-rw-r--r--src/imports/platform/widgets/widgets.pri58
2 files changed, 88 insertions, 19 deletions
diff --git a/src/imports/platform/widgets/qwidgetplatform_p.h b/src/imports/platform/widgets/qwidgetplatform_p.h
index 792e87aa..5a983a33 100644
--- a/src/imports/platform/widgets/qwidgetplatform_p.h
+++ b/src/imports/platform/widgets/qwidgetplatform_p.h
@@ -56,14 +56,27 @@
#include <QtGui/qpa/qplatformmenu.h>
#ifdef QT_WIDGETS_LIB
+#include <QtWidgets/qtwidgetsglobal.h>
+#if QT_CONFIG(colordialog)
#include "qwidgetplatformcolordialog_p.h"
+#endif
+#if QT_CONFIG(filedialog)
#include "qwidgetplatformfiledialog_p.h"
+#endif
+#if QT_CONFIG(fontdialog)
#include "qwidgetplatformfontdialog_p.h"
+#endif
+#if QT_CONFIG(messagebox)
#include "qwidgetplatformmessagedialog_p.h"
+#endif
+#if QT_CONFIG(menu)
#include "qwidgetplatformmenu_p.h"
#include "qwidgetplatformmenuitem_p.h"
+#endif
+#ifndef QT_NO_SYSTEMTRAYICON
#include "qwidgetplatformsystemtrayicon_p.h"
#endif
+#endif
QT_BEGIN_NAMESPACE
@@ -104,19 +117,45 @@ namespace QWidgetPlatform
return nullptr;
}
- static inline QPlatformMenu *createMenu(QObject *parent = nullptr) { return createWidget<QWidgetPlatformMenu>("Menu", parent); }
- static inline QPlatformMenuItem *createMenuItem(QObject *parent = nullptr) { return createWidget<QWidgetPlatformMenuItem>("MenuItem", parent); }
- static inline QPlatformSystemTrayIcon *createSystemTrayIcon(QObject *parent = nullptr) { return createWidget<QWidgetPlatformSystemTrayIcon>("SystemTrayIcon", parent); }
+ static inline QPlatformMenu *createMenu(QObject *parent = nullptr) {
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(menu)
+ return createWidget<QWidgetPlatformMenu>("Menu", parent);
+#else
+ return nullptr;
+#endif
+ }
+ static inline QPlatformMenuItem *createMenuItem(QObject *parent = nullptr) {
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(menu)
+ return createWidget<QWidgetPlatformMenuItem>("MenuItem", parent);
+#else
+ return nullptr;
+#endif
+ }
+ static inline QPlatformSystemTrayIcon *createSystemTrayIcon(QObject *parent = nullptr) {
+#ifndef QT_NO_SYSTEMTRAYICON
+ return createWidget<QWidgetPlatformSystemTrayIcon>("SystemTrayIcon", parent);
+#else
+ return nullptr;
+#endif
+ }
static inline QPlatformDialogHelper *createDialog(QPlatformTheme::DialogType type, QObject *parent = nullptr)
{
switch (type) {
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
case QPlatformTheme::ColorDialog: return createWidget<QWidgetPlatformColorDialog>("ColorDialog", parent);
+#endif
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog)
case QPlatformTheme::FileDialog: return createWidget<QWidgetPlatformFileDialog>("FileDialog", parent);
+#endif
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
case QPlatformTheme::FontDialog: return createWidget<QWidgetPlatformFontDialog>("FontDialog", parent);
+#endif
+#if defined(QT_WIDGETS_LIB) && QT_CONFIG(messagebox)
case QPlatformTheme::MessageDialog: return createWidget<QWidgetPlatformMessageDialog>("MessageDialog", parent);
- default: Q_UNREACHABLE(); break;
- return nullptr;
+#endif
+ default: break;
}
+ return nullptr;
}
}
diff --git a/src/imports/platform/widgets/widgets.pri b/src/imports/platform/widgets/widgets.pri
index c904e924..84efd930 100644
--- a/src/imports/platform/widgets/widgets.pri
+++ b/src/imports/platform/widgets/widgets.pri
@@ -3,21 +3,51 @@ DEPENDPATH += $$PWD
HEADERS += \
$$PWD/qwidgetplatform_p.h \
- $$PWD/qwidgetplatformcolordialog_p.h \
- $$PWD/qwidgetplatformdialog_p.h \
- $$PWD/qwidgetplatformfiledialog_p.h \
- $$PWD/qwidgetplatformfontdialog_p.h \
- $$PWD/qwidgetplatformmenu_p.h \
- $$PWD/qwidgetplatformmenuitem_p.h \
- $$PWD/qwidgetplatformmessagedialog_p.h \
$$PWD/qwidgetplatformsystemtrayicon_p.h
SOURCES += \
- $$PWD/qwidgetplatformcolordialog.cpp \
- $$PWD/qwidgetplatformdialog.cpp \
- $$PWD/qwidgetplatformfiledialog.cpp \
- $$PWD/qwidgetplatformfontdialog.cpp \
- $$PWD/qwidgetplatformmenu.cpp \
- $$PWD/qwidgetplatformmenuitem.cpp \
- $$PWD/qwidgetplatformmessagedialog.cpp \
$$PWD/qwidgetplatformsystemtrayicon.cpp
+
+qtConfig(colordialog) | qtConfig(filedialog) | qtConfig(fontdialog) | qtConfig(messagebox) {
+ HEADERS += \
+ $$PWD/qwidgetplatformdialog_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformdialog.cpp
+}
+
+qtConfig(colordialog) {
+ HEADERS += \
+ $$PWD/qwidgetplatformcolordialog_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformcolordialog.cpp
+}
+
+qtConfig(filedialog) {
+ HEADERS += \
+ $$PWD/qwidgetplatformfiledialog_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformfiledialog.cpp
+}
+
+qtConfig(fontdialog) {
+ HEADERS += \
+ $$PWD/qwidgetplatformfontdialog_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformfontdialog.cpp
+}
+
+qtConfig(menu) {
+ HEADERS += \
+ $$PWD/qwidgetplatformmenu_p.h \
+ $$PWD/qwidgetplatformmenuitem_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformmenu.cpp \
+ $$PWD/qwidgetplatformmenuitem.cpp
+}
+
+qtConfig(messagebox) {
+ HEADERS += \
+ $$PWD/qwidgetplatformmessagedialog_p.h
+ SOURCES += \
+ $$PWD/qwidgetplatformmessagedialog.cpp
+}