diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-02-15 11:54:33 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-02-15 12:25:58 +0000 |
commit | 5b711c320c6810804adde39b04d3eedc12a409f4 (patch) | |
tree | bd297b8e8c0005b8b8aed8ce19173e4f8b30e70e /src/quicktemplates2/qquickcontrol.cpp | |
parent | f6fec74d4238e304643b99880bdfd8ee32c8578e (diff) |
Move QQuickControlPrivate::themeFont|Palette() to QQuickTheme
QPlatformTheme is too limited for our theming purposes. We need support
for separate palettes (and later, icon colors) in dark and light themes.
Also, the fact that Qt Quick Controls 2 injects a platform proxy theme
does have undesired side effects in Qt Widgets and Qt Quick Controls 1.
Therefore, we start separating QPlatformTheme and QQuickTheme. The first
step is to eliminate some direct QPlatformTheme access in QQuickControl
and route it via QQuickTheme instead.
Task-number: QTBUG-51921
Change-Id: I055471a75ed6f26968796496efd1892975447c98
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickcontrol.cpp')
-rw-r--r-- | src/quicktemplates2/qquickcontrol.cpp | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index c2d63f02..03a92b00 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -50,9 +50,6 @@ #include "qquickapplicationwindow_p.h" #include "qquickdeferredexecute_p_p.h" -#include <QtGui/private/qguiapplication_p.h> -#include <QtGui/qpa/qplatformtheme.h> - #if QT_CONFIG(accessibility) #include <QtQuick/private/qquickaccessibleattached_p.h> #endif @@ -400,21 +397,7 @@ QFont QQuickControlPrivate::parentFont(const QQuickItem *item) if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window())) return window->font(); - return themeFont(QPlatformTheme::SystemFont); -} - -QFont QQuickControlPrivate::themeFont(QPlatformTheme::Font type) -{ - if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { - if (const QFont *font = theme->font(type)) { - QFont f = *font; - if (type == QPlatformTheme::SystemFont) - f.resolve(0); - return f; - } - } - - return QFont(); + return QQuickTheme::themeFont(QQuickTheme::SystemFont); } /*! @@ -505,21 +488,7 @@ QPalette QQuickControlPrivate::parentPalette(const QQuickItem *item) if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window())) return window->palette(); - return themePalette(QPlatformTheme::SystemPalette); -} - -QPalette QQuickControlPrivate::themePalette(QPlatformTheme::Palette type) -{ - if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { - if (const QPalette *palette = theme->palette(type)) { - QPalette p = *palette; - if (type == QPlatformTheme::SystemPalette) - p.resolve(0); - return p; - } - } - - return QPalette(); + return QQuickTheme::themePalette(QQuickTheme::SystemPalette); } /*! @@ -1571,12 +1540,12 @@ void QQuickControl::componentComplete() QFont QQuickControl::defaultFont() const { - return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont); + return QQuickTheme::themeFont(QQuickTheme::SystemFont); } QPalette QQuickControl::defaultPalette() const { - return QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette); + return QQuickTheme::themePalette(QQuickTheme::SystemPalette); } void QQuickControl::focusInEvent(QFocusEvent *event) |