aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-05-15 23:29:46 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2018-05-16 08:10:05 +0000
commit9338e1285e47060f3998ac19d047e93a11252ffb (patch)
tree507d94919d8f0d83b78606564fe1cf408d78ddd0 /src/quicktemplates2
parent9d442922425f36d96f68f4fff83f3aca90aea6df (diff)
Rename QQuickTheme::current to instance
Avoid giving a wrong impression that the theme instance could be changed on the fly. Change-Id: Ifb5078422385d2f15da6a416d89cc9d6f46b0f40 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquicktheme.cpp15
-rw-r--r--src/quicktemplates2/qquicktheme_p.h3
-rw-r--r--src/quicktemplates2/qquicktheme_p_p.h2
3 files changed, 7 insertions, 13 deletions
diff --git a/src/quicktemplates2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp
index 30185fe2..bfa34001 100644
--- a/src/quicktemplates2/qquicktheme.cpp
+++ b/src/quicktemplates2/qquicktheme.cpp
@@ -42,7 +42,7 @@
QT_BEGIN_NAMESPACE
-QScopedPointer<QQuickTheme> QQuickThemePrivate::current;
+QScopedPointer<QQuickTheme> QQuickThemePrivate::instance;
static QPlatformTheme::Font platformFont(QQuickTheme::Scope scope)
{
@@ -126,20 +126,15 @@ QQuickTheme::~QQuickTheme()
{
}
-QQuickTheme *QQuickTheme::current()
+QQuickTheme *QQuickTheme::instance()
{
- return QQuickThemePrivate::current.data();
-}
-
-void QQuickTheme::setCurrent(QQuickTheme *theme)
-{
- QQuickThemePrivate::current.reset(theme);
+ return QQuickThemePrivate::instance.data();
}
QFont QQuickTheme::themeFont(Scope scope)
{
const QFont *font = nullptr;
- if (QQuickTheme *theme = current())
+ if (QQuickTheme *theme = instance())
font = QQuickThemePrivate::get(theme)->resolveThemeFont(scope);
else if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
font = theme->font(platformFont(scope));
@@ -157,7 +152,7 @@ QFont QQuickTheme::themeFont(Scope scope)
QPalette QQuickTheme::themePalette(Scope scope)
{
const QPalette *palette = nullptr;
- if (QQuickTheme *theme = current())
+ if (QQuickTheme *theme = instance())
palette = QQuickThemePrivate::get(theme)->resolveThemePalette(scope);
else if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
palette = theme->palette(platformPalette(scope));
diff --git a/src/quicktemplates2/qquicktheme_p.h b/src/quicktemplates2/qquicktheme_p.h
index 32044b67..eb10d766 100644
--- a/src/quicktemplates2/qquicktheme_p.h
+++ b/src/quicktemplates2/qquicktheme_p.h
@@ -63,8 +63,7 @@ public:
QQuickTheme();
virtual ~QQuickTheme();
- static QQuickTheme *current();
- static void setCurrent(QQuickTheme *theme);
+ static QQuickTheme *instance();
enum Scope {
System,
diff --git a/src/quicktemplates2/qquicktheme_p_p.h b/src/quicktemplates2/qquicktheme_p_p.h
index e9593865..e43c8034 100644
--- a/src/quicktemplates2/qquicktheme_p_p.h
+++ b/src/quicktemplates2/qquicktheme_p_p.h
@@ -65,7 +65,7 @@ public:
const QFont *resolveThemeFont(QQuickTheme::Scope scope);
const QPalette *resolveThemePalette(QQuickTheme::Scope scope);
- static QScopedPointer<QQuickTheme> current;
+ static QScopedPointer<QQuickTheme> instance;
bool hasResolvedFonts = false;
bool hasResolvedPalettes = false;