summaryrefslogtreecommitdiff
path: root/src/plugins/welcome
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-11-08 14:39:17 +0100
committerUlf Hermann <ulf.hermann@qt.io>2016-11-08 17:58:49 +0000
commit08b780205a91aef12141cc0650a6197794f09e00 (patch)
tree32b72ec5ccb9fd077c09f71b3a04ce36d48395be /src/plugins/welcome
parent062512a246279b632a93db544445a447d8cf2633 (diff)
downloadqt-creator-08b780205a91aef12141cc0650a6197794f09e00.tar.gz
Theme: Use QVariantMap for theme properties
QML can directly mirror this into a JavaScript object, so there is no need to manually copy the values into a different container. Also, QQmlPropertyMap is very expensive as it will listen to changes to any value in the map. We never use this. It would be entirely enough to update the whole map at once if we ever want to update the theme at runtime. Change-Id: Ie2b549e9af51d620801808c87d6f659cc7a06c04 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Diffstat (limited to 'src/plugins/welcome')
-rw-r--r--src/plugins/welcome/welcomeplugin.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp
index ac3d3a01fa..884eeb30db 100644
--- a/src/plugins/welcome/welcomeplugin.cpp
+++ b/src/plugins/welcome/welcomeplugin.cpp
@@ -158,7 +158,6 @@ private:
void sceneGraphError(QQuickWindow::SceneGraphError, const QString &message);
void facilitateQml(QQmlEngine *engine);
void addPages(const QList<IWelcomePage *> &pages);
- void applyTheme();
void addKeyboardShortcuts();
QWidget *m_modeWidget;
@@ -166,7 +165,6 @@ private:
QMap<Id, IWelcomePage *> m_idPageMap;
QList<IWelcomePage *> m_pluginList;
int m_activePlugin;
- QQmlPropertyMap m_themeProperties;
QStringList m_recentProjectsShortcuts;
QStringList m_sessionsShortcuts;
};
@@ -197,7 +195,6 @@ WelcomeMode::WelcomeMode()
layout->setSpacing(0);
m_welcomePage = new QQuickWidget;
- applyTheme(); // initialize background color and theme properties
m_welcomePage->setResizeMode(QQuickWidget::SizeRootObjectToView);
m_welcomePage->setObjectName(QLatin1String("WelcomePage"));
@@ -217,13 +214,6 @@ WelcomeMode::WelcomeMode()
setWidget(m_modeWidget);
}
-void WelcomeMode::applyTheme()
-{
- const QVariantHash creatorTheme = Utils::creatorTheme()->values();
- for (auto it = creatorTheme.constBegin(); it != creatorTheme.constEnd(); ++it)
- m_themeProperties.insert(it.key(), it.value());
-}
-
void WelcomeMode::addKeyboardShortcuts()
{
const int actionsCount = 9;
@@ -294,7 +284,7 @@ void WelcomeMode::facilitateQml(QQmlEngine *engine)
QQmlContext *ctx = engine->rootContext();
ctx->setContextProperty(QLatin1String("welcomeMode"), this);
- ctx->setContextProperty(QLatin1String("creatorTheme"), &m_themeProperties);
+ ctx->setContextProperty(QLatin1String("creatorTheme"), Utils::creatorTheme()->values());
ctx->setContextProperty(QLatin1String("useNativeText"), true);
}