diff options
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquicktheme.cpp | 28 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktheme_p.h | 5 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktheme_p_p.h | 4 |
3 files changed, 3 insertions, 34 deletions
diff --git a/src/quicktemplates2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp index b8ced7b9..1ea0cef2 100644 --- a/src/quicktemplates2/qquicktheme.cpp +++ b/src/quicktemplates2/qquicktheme.cpp @@ -94,26 +94,6 @@ static QPlatformTheme::Palette platformPalette(QQuickTheme::Scope scope) } } -const QFont *QQuickThemePrivate::resolveThemeFont(QQuickTheme::Scope scope) -{ - Q_Q(QQuickTheme); - if (!hasResolved) { - q->resolve(); - hasResolved = true; - } - return fonts[scope].data(); -} - -const QPalette *QQuickThemePrivate::resolveThemePalette(QQuickTheme::Scope scope) -{ - Q_Q(QQuickTheme); - if (!hasResolved) { - q->resolve(); - hasResolved = true; - } - return palettes[scope].data(); -} - QQuickTheme::QQuickTheme() : d_ptr(new QQuickThemePrivate) { @@ -133,7 +113,7 @@ QFont QQuickTheme::font(Scope scope) { const QFont *font = nullptr; if (QQuickTheme *theme = instance()) - font = QQuickThemePrivate::get(theme)->resolveThemeFont(scope); + font = QQuickThemePrivate::get(theme)->fonts[scope].data(); else if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) font = theme->font(platformFont(scope)); @@ -154,7 +134,7 @@ QPalette QQuickTheme::palette(Scope scope) { const QPalette *palette = nullptr; if (QQuickTheme *theme = instance()) - palette = QQuickThemePrivate::get(theme)->resolveThemePalette(scope); + palette = QQuickThemePrivate::get(theme)->palettes[scope].data(); else if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) palette = theme->palette(platformPalette(scope)); @@ -183,8 +163,4 @@ void QQuickTheme::setPalette(Scope scope, const QPalette &palette) d->palettes[scope] = QSharedPointer<QPalette>::create(d->defaultPalette ? d->defaultPalette->resolve(palette) : palette); } -void QQuickTheme::resolve() -{ -} - QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquicktheme_p.h b/src/quicktemplates2/qquicktheme_p.h index 44610c09..d51cc5b6 100644 --- a/src/quicktemplates2/qquicktheme_p.h +++ b/src/quicktemplates2/qquicktheme_p.h @@ -61,7 +61,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTheme { public: QQuickTheme(); - virtual ~QQuickTheme(); + ~QQuickTheme(); static QQuickTheme *instance(); @@ -90,12 +90,9 @@ public: static QFont font(Scope scope); static QPalette palette(Scope scope); -protected: void setFont(Scope scope, const QFont &font); void setPalette(Scope scope, const QPalette &palette); - virtual void resolve(); - private: Q_DISABLE_COPY(QQuickTheme) Q_DECLARE_PRIVATE(QQuickTheme) diff --git a/src/quicktemplates2/qquicktheme_p_p.h b/src/quicktemplates2/qquicktheme_p_p.h index 6a32440f..c7421677 100644 --- a/src/quicktemplates2/qquicktheme_p_p.h +++ b/src/quicktemplates2/qquicktheme_p_p.h @@ -62,14 +62,10 @@ public: return theme->d_func(); } - const QFont *resolveThemeFont(QQuickTheme::Scope scope); - const QPalette *resolveThemePalette(QQuickTheme::Scope scope); - static QScopedPointer<QQuickTheme> instance; static const int NScopes = QQuickTheme::Tumbler + 1; - bool hasResolved = false; QScopedPointer<const QFont> defaultFont; QScopedPointer<const QPalette> defaultPalette; QSharedPointer<QFont> fonts[NScopes]; |