diff options
author | Grigorii Zimin <gzimin@luxoft.com> | 2020-02-19 13:32:44 +0300 |
---|---|---|
committer | Grigorii Zimin <gzimin@luxoft.com> | 2020-02-21 08:44:26 +0000 |
commit | 0525591041f9f6d7097cd14feb6dfd53f9d3a059 (patch) | |
tree | d330c8f9c04c418b18c6276610151971fc981c5a /plugins/style | |
parent | bd5274ceb72f57189a605c0ec9122232ad3c11c8 (diff) |
[style] the accent color is pushed to the theme settings
Themes may have different color palettes, this patch fix Style plugin for
this option
Fixes: AUTOSUITE-1489
Change-Id: I3fcc0cd0b401d64a75dbe955aab358e2124407b9
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
Diffstat (limited to 'plugins/style')
-rw-r--r-- | plugins/style/Style.cpp | 4 | ||||
-rw-r--r-- | plugins/style/StyleData.h | 4 | ||||
-rw-r--r-- | plugins/style/StyleDefaults.cpp | 5 |
3 files changed, 6 insertions, 7 deletions
diff --git a/plugins/style/Style.cpp b/plugins/style/Style.cpp index d2935c31..4a6d44a1 100644 --- a/plugins/style/Style.cpp +++ b/plugins/style/Style.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2019-2020 Luxoft Sweden AB ** Copyright (C) 2018 Pelagicore AG ** Contact: https://www.qt.io/licensing/ ** @@ -57,7 +57,7 @@ Style *Style::qmlAttachedProperties(QObject *object) void Style::init() { m_theme = StyleDefaults::instance()->data().theme; - m_accentColor = StyleDefaults::instance()->data().accentColor; + m_accentColor = StyleDefaults::instance()->dataFromTheme(m_theme).accentColor; QQuickAttachedObject::init(); } diff --git a/plugins/style/StyleData.h b/plugins/style/StyleData.h index a812a328..177a67a3 100644 --- a/plugins/style/StyleData.h +++ b/plugins/style/StyleData.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2019-2020 Luxoft Sweden AB ** Copyright (C) 2018 Pelagicore AG ** Contact: https://www.qt.io/licensing/ ** @@ -37,9 +37,9 @@ struct StyleData { enum Theme { Light = 0, Dark = 1 } theme; - QColor accentColor; struct ThemeData { + QColor accentColor; QColor backgroundColor; QColor buttonColor; QColor highlightedButtonColor; diff --git a/plugins/style/StyleDefaults.cpp b/plugins/style/StyleDefaults.cpp index a7a45a8c..3370d3c2 100644 --- a/plugins/style/StyleDefaults.cpp +++ b/plugins/style/StyleDefaults.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 Luxoft Sweden AB +** Copyright (C) 2019-2020 Luxoft Sweden AB ** Copyright (C) 2018 Pelagicore AG ** Contact: https://www.qt.io/licensing/ ** @@ -83,8 +83,6 @@ StyleDefaults::StyleDefaults() CHECK_KEY("Theme") m_data.theme = settings.value("Theme").toString() == QString("Light") ? StyleData::Light : StyleData::Dark; - FETCH_COLOR(m_data.accentColor, "AccentColor") - QStringList themes = settings.childGroups(); if (themes.contains("Light")) { @@ -102,6 +100,7 @@ StyleDefaults::StyleDefaults() void StyleDefaults::loadTheme(StyleData::ThemeData &data, QSettings &settings) { + FETCH_COLOR(data.accentColor, "AccentColor"); FETCH_COLOR(data.backgroundColor, "BackgroundColor"); FETCH_COLOR(data.buttonColor, "ButtonColor"); FETCH_COLOR(data.highlightedButtonColor, "HighlightedButtonColor"); |