macOS: Remove QtWidget dependency from platform plugin
The dialog helpers don't depend on widgets themselves, and should be built regardless of whether the widget dialogs are enabled, as these helpers can (and should) be used by other layers, such as Qt Quick. Change-Id: I1c66b474ab2f29748f1256aea90229c51c12a16f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
9dd8e655cd
commit
1cee9cc587
@ -43,6 +43,9 @@ qt_internal_add_plugin(QCocoaIntegrationPlugin
|
||||
qnsview.h qnsview.mm
|
||||
qnswindow.h qnswindow.mm
|
||||
qnswindowdelegate.h qnswindowdelegate.mm
|
||||
qcocoacolordialoghelper.h qcocoacolordialoghelper.mm
|
||||
qcocoafiledialoghelper.h qcocoafiledialoghelper.mm
|
||||
qcocoafontdialoghelper.h qcocoafontdialoghelper.mm
|
||||
DEFINES
|
||||
QT_NO_FOREACH
|
||||
PUBLIC_LIBRARIES
|
||||
@ -110,21 +113,5 @@ qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_sessionmanager
|
||||
|
||||
#### Keys ignored in scope 7:.:.:cocoa.pro:TARGET Qt::Widgets:
|
||||
# QT_FOR_CONFIG = "widgets"
|
||||
|
||||
qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_colordialog AND TARGET Qt::Widgets
|
||||
SOURCES
|
||||
qcocoacolordialoghelper.h qcocoacolordialoghelper.mm
|
||||
)
|
||||
|
||||
qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_filedialog AND TARGET Qt::Widgets
|
||||
SOURCES
|
||||
qcocoafiledialoghelper.h qcocoafiledialoghelper.mm
|
||||
)
|
||||
|
||||
qt_extend_target(QCocoaIntegrationPlugin CONDITION QT_FEATURE_fontdialog AND TARGET Qt::Widgets
|
||||
SOURCES
|
||||
qcocoafontdialoghelper.h qcocoafontdialoghelper.mm
|
||||
)
|
||||
|
||||
#### Keys ignored in scope 12:.:.:cocoa.pro:NOT TARGET___equals____ss_QT_DEFAULT_QPA_PLUGIN:
|
||||
# PLUGIN_EXTENDS = "-"
|
||||
|
@ -31,7 +31,10 @@ SOURCES += main.mm \
|
||||
qcocoaintrospection.mm \
|
||||
qcocoakeymapper.mm \
|
||||
qcocoamimetypes.mm \
|
||||
qiosurfacegraphicsbuffer.mm
|
||||
qiosurfacegraphicsbuffer.mm \
|
||||
qcocoacolordialoghelper.mm \
|
||||
qcocoafiledialoghelper.mm \
|
||||
qcocoafontdialoghelper.mm
|
||||
|
||||
HEADERS += qcocoaintegration.h \
|
||||
qcocoascreen.h \
|
||||
@ -63,7 +66,10 @@ HEADERS += qcocoaintegration.h \
|
||||
qcocoaintrospection.h \
|
||||
qcocoakeymapper.h \
|
||||
qiosurfacegraphicsbuffer.h \
|
||||
qcocoamimetypes.h
|
||||
qcocoamimetypes.h \
|
||||
qcocoacolordialoghelper.h \
|
||||
qcocoafiledialoghelper.h \
|
||||
qcocoafontdialoghelper.h
|
||||
|
||||
qtConfig(opengl.*) {
|
||||
SOURCES += qcocoaglcontext.mm
|
||||
@ -97,27 +103,6 @@ QT += core-private gui-private
|
||||
|
||||
CONFIG += no_app_extension_api_only
|
||||
|
||||
qtHaveModule(widgets) {
|
||||
QT_FOR_CONFIG += widgets
|
||||
|
||||
qtConfig(colordialog) {
|
||||
SOURCES += qcocoacolordialoghelper.mm
|
||||
HEADERS += qcocoacolordialoghelper.h
|
||||
}
|
||||
|
||||
qtConfig(filedialog) {
|
||||
SOURCES += qcocoafiledialoghelper.mm
|
||||
HEADERS += qcocoafiledialoghelper.h
|
||||
}
|
||||
|
||||
qtConfig(fontdialog) {
|
||||
SOURCES += qcocoafontdialoghelper.mm
|
||||
HEADERS += qcocoafontdialoghelper.h
|
||||
}
|
||||
|
||||
QT += widgets-private
|
||||
}
|
||||
|
||||
OTHER_FILES += cocoa.json
|
||||
|
||||
PLUGIN_TYPE = platforms
|
||||
|
@ -40,13 +40,9 @@
|
||||
#ifndef QCOCOACOLORDIALOGHELPER_H
|
||||
#define QCOCOACOLORDIALOGHELPER_H
|
||||
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(colordialog);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCocoaColorDialogHelper : public QPlatformColorDialogHelper
|
||||
|
@ -41,14 +41,11 @@
|
||||
#define QCOCOAFILEDIALOGHELPER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
#include <QtCore/private/qcore_mac_p.h>
|
||||
|
||||
#import <AppKit/NSSavePanel.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(filedialog);
|
||||
|
||||
@interface QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) : NSObject<NSOpenSavePanelDelegate>
|
||||
@end
|
||||
|
||||
|
@ -41,11 +41,8 @@
|
||||
#define QCOCOAFONTDIALOGHELPER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(fontdialog);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCocoaFontDialogHelper : public QPlatformFontDialogHelper
|
||||
|
@ -49,10 +49,6 @@
|
||||
#include <private/qwindow_p.h>
|
||||
#include <QtGui/private/qcoregraphics_p.h>
|
||||
|
||||
#ifndef QT_NO_WIDGETS
|
||||
#include <QtWidgets/QWidget>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <mach-o/dyld.h>
|
||||
|
@ -68,13 +68,6 @@
|
||||
|
||||
#include <QtGui/private/qfontengine_coretext_p.h>
|
||||
|
||||
#ifdef QT_WIDGETS_LIB
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#if QT_CONFIG(filedialog)
|
||||
#include "qcocoafiledialoghelper.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
|
||||
static void initResources()
|
||||
|
@ -63,18 +63,9 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
|
||||
#ifdef QT_WIDGETS_LIB
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
#if QT_CONFIG(colordialog)
|
||||
#include "qcocoacolordialoghelper.h"
|
||||
#endif
|
||||
#if QT_CONFIG(filedialog)
|
||||
#include "qcocoafiledialoghelper.h"
|
||||
#endif
|
||||
#if QT_CONFIG(fontdialog)
|
||||
#include "qcocoafontdialoghelper.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
@ -329,32 +320,22 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const
|
||||
{
|
||||
if (dialogType == QPlatformTheme::FileDialog)
|
||||
return true;
|
||||
#if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
|
||||
if (dialogType == QPlatformTheme::ColorDialog)
|
||||
return true;
|
||||
#endif
|
||||
#if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
|
||||
if (dialogType == QPlatformTheme::FontDialog)
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
QPlatformDialogHelper *QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const
|
||||
{
|
||||
switch (dialogType) {
|
||||
#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog)
|
||||
case QPlatformTheme::FileDialog:
|
||||
return new QCocoaFileDialogHelper();
|
||||
#endif
|
||||
#if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog)
|
||||
case QPlatformTheme::ColorDialog:
|
||||
return new QCocoaColorDialogHelper();
|
||||
#endif
|
||||
#if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog)
|
||||
case QPlatformTheme::FontDialog:
|
||||
return new QCocoaFontDialogHelper();
|
||||
#endif
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user