summaryrefslogtreecommitdiffstats
path: root/src/datavisualization
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization')
-rw-r--r--src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp2
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp13
-rw-r--r--src/datavisualization/engine/abstract3dcontroller_p.h1
-rw-r--r--src/datavisualization/theme/q3dtheme.cpp31
-rw-r--r--src/datavisualization/theme/q3dtheme_p.h15
-rw-r--r--src/datavisualization/theme/thememanager.cpp510
-rw-r--r--src/datavisualization/theme/thememanager_p.h47
7 files changed, 321 insertions, 298 deletions
diff --git a/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp b/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp
index aa0ee859..ba3577cd 100644
--- a/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_q3dtheme.cpp
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
//! [3]
Q3DBars *graph = new Q3DBars();
- graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemePrimaryColors));
+ graph->activeTheme()->setType(Q3DTheme::ThemePrimaryColors);
graph->activeTheme()->setBaseColor(Qt::red);
graph->activeTheme()->setSingleHighlightColor(Qt::yellow);
//! [3]
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
index 500ce9dc..fb732139 100644
--- a/src/datavisualization/engine/abstract3dcontroller.cpp
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -446,6 +446,19 @@ void Abstract3DController::handleThemeMultiHighlightGradientChanged(const QLinea
markSeriesVisualsDirty();
}
+void Abstract3DController::handleThemeTypeChanged(Q3DTheme::Theme theme)
+{
+ Q_UNUSED(theme)
+
+ // Changing theme type is logically equivalent of changing the entire theme
+ // object, so reset all attached series to the new theme.
+
+ Q3DTheme *activeTheme = m_themeManager->activeTheme();
+ for (int i = 0; i < m_seriesList.size(); i++)
+ m_seriesList.at(i)->d_ptr->resetToTheme(*activeTheme, i, true);
+ markSeriesVisualsDirty();
+}
+
void Abstract3DController::setAxisX(Q3DAbstractAxis *axis)
{
setAxisHelper(Q3DAbstractAxis::AxisOrientationX, axis, &m_axisX);
diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h
index a862a961..66c61a53 100644
--- a/src/datavisualization/engine/abstract3dcontroller_p.h
+++ b/src/datavisualization/engine/abstract3dcontroller_p.h
@@ -249,6 +249,7 @@ public slots:
void handleThemeSingleHighlightGradientChanged(const QLinearGradient &gradient);
void handleThemeMultiHighlightColorChanged(const QColor &color);
void handleThemeMultiHighlightGradientChanged(const QLinearGradient &gradient);
+ void handleThemeTypeChanged(Q3DTheme::Theme theme);
// Renderer callback handlers
void handleRequestShadowQuality(QDataVis::ShadowQuality quality);
diff --git a/src/datavisualization/theme/q3dtheme.cpp b/src/datavisualization/theme/q3dtheme.cpp
index 11773940..bf225b83 100644
--- a/src/datavisualization/theme/q3dtheme.cpp
+++ b/src/datavisualization/theme/q3dtheme.cpp
@@ -17,6 +17,7 @@
****************************************************************************/
#include "q3dtheme_p.h"
+#include "thememanager_p.h"
QT_DATAVISUALIZATION_BEGIN_NAMESPACE
@@ -377,10 +378,9 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
* \qmlproperty Theme3D.Theme Theme3D::type
*
* The type of the theme. If no type is set, the type is \c Theme3D.ThemeUserDefined.
- * \note Changing the type to one of the predefined types doesn't reset the properties
- * that have been explicitly set since the last render cycle. This is done to allow
- * customization of predefined types also from QML. It is not recommended
- * changing the type of an existing Theme3D item via this property.
+ * Changing the theme type after the item has been constructed will change all other properties
+ * of the theme to what the predefined theme specifies. Changing the theme type of the active theme
+ * of the graph will also reset all attached series to use the new theme.
*/
/*!
@@ -389,7 +389,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE
*/
Q3DTheme::Q3DTheme(QObject *parent)
: QObject(parent),
- d_ptr(new Q3DThemePrivate(this, ThemeUserDefined))
+ d_ptr(new Q3DThemePrivate(this))
{
}
@@ -400,8 +400,9 @@ Q3DTheme::Q3DTheme(QObject *parent)
*/
Q3DTheme::Q3DTheme(Theme themeType, QObject *parent)
: QObject(parent),
- d_ptr(new Q3DThemePrivate(this, themeType))
+ d_ptr(new Q3DThemePrivate(this))
{
+ setType(themeType);
}
/*!
@@ -412,7 +413,7 @@ Q3DTheme::Q3DTheme(Q3DThemePrivate *d, Theme themeType,
QObject(parent),
d_ptr(d)
{
- d_ptr->m_themeId = themeType;
+ setType(themeType);
}
/*!
@@ -866,17 +867,18 @@ Q3DTheme::ColorStyle Q3DTheme::colorStyle() const
/*!
* \property Q3DTheme::type
*
- * The type of the theme. Type is automatically set when constructing a theme.
- * \note Changing the type to one of the predefined types doesn't reset the properties
- * that have been explicitly set since the last render cycle. This is done to allow
- * customization of predefined types also from QML. It is not recommended
- * changing the type of an existing Q3DTheme object via this property.
+ * The type of the theme. The type is automatically set when constructing a theme,
+ * but can also be changed later. Changing the theme type will change all other
+ * properties of the theme to what the predefined theme specifies.
+ * Changing the theme type of the active theme of the graph will also reset all
+ * attached series to use the new theme.
*/
void Q3DTheme::setType(Theme themeType)
{
d_ptr->m_dirtyBits.themeIdDirty = true;
if (d_ptr->m_themeId != themeType) {
d_ptr->m_themeId = themeType;
+ ThemeManager::setPredefinedPropertiesToTheme(this, themeType);
emit typeChanged(themeType);
}
}
@@ -888,9 +890,9 @@ Q3DTheme::Theme Q3DTheme::type() const
// Q3DThemePrivate
-Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, Q3DTheme::Theme theme_id)
+Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q)
: QObject(0),
- m_themeId(theme_id),
+ m_themeId(Q3DTheme::ThemeUserDefined),
m_backgroundColor(Qt::black),
m_windowColor(Qt::black),
m_textColor(Qt::white),
@@ -915,6 +917,7 @@ Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, Q3DTheme::Theme theme_id)
m_gridEnabled(true),
m_labelBackground(true),
m_isDefaultTheme(false),
+ m_forcePredefinedType(true),
q_ptr(q)
{
m_baseColors.append(QColor(Qt::black));
diff --git a/src/datavisualization/theme/q3dtheme_p.h b/src/datavisualization/theme/q3dtheme_p.h
index 24994854..078c2d7d 100644
--- a/src/datavisualization/theme/q3dtheme_p.h
+++ b/src/datavisualization/theme/q3dtheme_p.h
@@ -85,12 +85,11 @@ struct Q3DThemeDirtyBitField {
}
};
-class Q3DThemePrivate : public QObject
+class QT_DATAVISUALIZATION_EXPORT Q3DThemePrivate : public QObject
{
Q_OBJECT
public:
- Q3DThemePrivate(Q3DTheme *q,
- Q3DTheme::Theme theme_id = Q3DTheme::ThemeUserDefined);
+ Q3DThemePrivate(Q3DTheme *q);
virtual ~Q3DThemePrivate();
void resetDirtyBits();
@@ -100,6 +99,15 @@ public:
inline bool isDefaultTheme() { return m_isDefaultTheme; }
inline void setDefaultTheme(bool isDefault) { m_isDefaultTheme = isDefault; }
+ // If m_forcePredefinedType is true, it means we should forcibly update all properties
+ // of the theme to those of the predefined theme, when setting the theme type. Otherwise
+ // we only change the properties that haven't been explicitly changed since last render cycle.
+ // Defaults to true, and is only ever set to false by DeclarativeTheme3D to enable using
+ // predefined themes as base for custom themes, since the order of initial property sets cannot
+ // be easily controlled in QML.
+ inline bool isForcePredefinedType() { return m_forcePredefinedType; }
+ inline void setForcePredefinedType(bool enable) { m_forcePredefinedType = enable; }
+
signals:
void needRender();
@@ -130,6 +138,7 @@ public:
bool m_gridEnabled;
bool m_labelBackground;
bool m_isDefaultTheme;
+ bool m_forcePredefinedType;
protected:
Q3DTheme *q_ptr;
diff --git a/src/datavisualization/theme/thememanager.cpp b/src/datavisualization/theme/thememanager.cpp
index 82e7bb53..d93e9b20 100644
--- a/src/datavisualization/theme/thememanager.cpp
+++ b/src/datavisualization/theme/thememanager.cpp
@@ -53,7 +53,7 @@ void ThemeManager::releaseTheme(Q3DTheme *theme)
if (theme->d_ptr->isDefaultTheme())
theme->d_ptr->setDefaultTheme(false);
- // If the axis is in use, replace it with a temporary one
+ // If the theme is in use, replace it with a temporary one
if (theme == m_activeTheme)
setActiveTheme(0);
@@ -81,7 +81,6 @@ void ThemeManager::setActiveTheme(Q3DTheme *theme)
// Disconnect the old theme from use
disconnect(m_activeTheme->d_ptr.data(), 0, m_controller, 0);
disconnect(m_activeTheme, 0, m_controller, 0);
- disconnect(m_activeTheme, 0, this, 0);
}
}
@@ -90,11 +89,6 @@ void ThemeManager::setActiveTheme(Q3DTheme *theme)
m_activeTheme = theme;
- Q3DTheme::Theme type = m_activeTheme->type();
-
- if (type != Q3DTheme::ThemeUserDefined)
- useTheme(type);
-
// Reset all bits to dirty for sync
m_activeTheme->d_ptr->resetDirtyBits();
@@ -128,325 +122,327 @@ void ThemeManager::connectThemeSignals()
m_controller, &Abstract3DController::handleThemeSingleHighlightGradientChanged);
connect(m_activeTheme, &Q3DTheme::multiHighlightGradientChanged,
m_controller, &Abstract3DController::handleThemeMultiHighlightGradientChanged);
+ connect(m_activeTheme, &Q3DTheme::typeChanged,
+ m_controller, &Abstract3DController::handleThemeTypeChanged);
connect(m_activeTheme->d_ptr.data(), &Q3DThemePrivate::needRender,
m_controller, &Abstract3DController::needRender);
-
- connect(m_activeTheme, &Q3DTheme::typeChanged, this, &ThemeManager::useTheme);
}
-void ThemeManager::useTheme(Q3DTheme::Theme type)
+void ThemeManager::setPredefinedPropertiesToTheme(Q3DTheme *theme, Q3DTheme::Theme type)
{
+ QList<QColor> baseColors;
+ QList<QLinearGradient> baseGradients;
switch (type) {
case Q3DTheme::ThemeQt: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0x80c342)));
baseColors.append(QColor(QRgb(0x469835)));
baseColors.append(QColor(QRgb(0x006325)));
baseColors.append(QColor(QRgb(0x5caa15)));
baseColors.append(QColor(QRgb(0x328930)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0xffffff)));
- setWindowColor(QColor(QRgb(0xffffff)));
- setTextColor(QColor(QRgb(0x35322f)));
- setTextBackgroundColor(QColor(0xff, 0xff, 0xff, 0x99));
- setGridLineColor(QColor(QRgb(0xd7d6d5)));
- setSingleHighlightColor(QColor(QRgb(0x14aaff)));
- setMultiHighlightColor(QColor(QRgb(0x6400aa)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(true);
- setColorStyle(Q3DTheme::ColorStyleUniform);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0x14aaff)), defaultColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0x6400aa)), defaultColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0xffffff)));
+ setWindowColor(theme, QColor(QRgb(0xffffff)));
+ setTextColor(theme, QColor(QRgb(0x35322f)));
+ setTextBackgroundColor(theme, QColor(0xff, 0xff, 0xff, 0x99));
+ setGridLineColor(theme, QColor(QRgb(0xd7d6d5)));
+ setSingleHighlightColor(theme, QColor(QRgb(0x14aaff)));
+ setMultiHighlightColor(theme, QColor(QRgb(0x6400aa)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, true);
+ setColorStyle(theme, Q3DTheme::ColorStyleUniform);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0x14aaff)),
+ defaultColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0x6400aa)),
+ defaultColorLevel));
break;
}
case Q3DTheme::ThemePrimaryColors: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0xffe400)));
baseColors.append(QColor(QRgb(0xfaa106)));
baseColors.append(QColor(QRgb(0xf45f0d)));
baseColors.append(QColor(QRgb(0xfcba04)));
baseColors.append(QColor(QRgb(0xf7800a)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0xffffff)));
- setWindowColor(QColor(QRgb(0xffffff)));
- setTextColor(QColor(QRgb(0x000000)));
- setTextBackgroundColor(QColor(0xff, 0xff, 0xff, 0x99));
- setGridLineColor(QColor(QRgb(0xd7d6d5)));
- setSingleHighlightColor(QColor(QRgb(0x27beee)));
- setMultiHighlightColor(QColor(QRgb(0xee1414)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(false);
- setColorStyle(Q3DTheme::ColorStyleUniform);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0x27beee)), defaultColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0xee1414)), defaultColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0xffffff)));
+ setWindowColor(theme, QColor(QRgb(0xffffff)));
+ setTextColor(theme, QColor(QRgb(0x000000)));
+ setTextBackgroundColor(theme, QColor(0xff, 0xff, 0xff, 0x99));
+ setGridLineColor(theme, QColor(QRgb(0xd7d6d5)));
+ setSingleHighlightColor(theme, QColor(QRgb(0x27beee)));
+ setMultiHighlightColor(theme, QColor(QRgb(0xee1414)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, false);
+ setColorStyle(theme, Q3DTheme::ColorStyleUniform);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0x27beee)),
+ defaultColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0xee1414)),
+ defaultColorLevel));
break;
}
case Q3DTheme::ThemeDigia: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0xeaeaea)));
baseColors.append(QColor(QRgb(0xa0a0a0)));
baseColors.append(QColor(QRgb(0x626262)));
baseColors.append(QColor(QRgb(0xbebebe)));
baseColors.append(QColor(QRgb(0x818181)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultBuiltInColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0xffffff)));
- setWindowColor(QColor(QRgb(0xffffff)));
- setTextColor(QColor(QRgb(0x000000)));
- setTextBackgroundColor(QColor(0xff, 0xff, 0xff, 0x80));
- setGridLineColor(QColor(QRgb(0xd7d6d5)));
- setSingleHighlightColor(QColor(QRgb(0xfa0000)));
- setMultiHighlightColor(QColor(QRgb(0x333333)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(false);
- setColorStyle(Q3DTheme::ColorStyleObjectGradient);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0xfa0000)), defaultBuiltInColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0x333333)), defaultBuiltInColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0xffffff)));
+ setWindowColor(theme, QColor(QRgb(0xffffff)));
+ setTextColor(theme, QColor(QRgb(0x000000)));
+ setTextBackgroundColor(theme, QColor(0xff, 0xff, 0xff, 0x80));
+ setGridLineColor(theme, QColor(QRgb(0xd7d6d5)));
+ setSingleHighlightColor(theme, QColor(QRgb(0xfa0000)));
+ setMultiHighlightColor(theme, QColor(QRgb(0x333333)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, false);
+ setColorStyle(theme, Q3DTheme::ColorStyleObjectGradient);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0xfa0000)),
+ defaultBuiltInColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0x333333)),
+ defaultBuiltInColorLevel));
break;
}
case Q3DTheme::ThemeStoneMoss: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0xbeb32b)));
baseColors.append(QColor(QRgb(0x928327)));
baseColors.append(QColor(QRgb(0x665423)));
baseColors.append(QColor(QRgb(0xa69929)));
baseColors.append(QColor(QRgb(0x7c6c25)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0x4d4d4f)));
- setWindowColor(QColor(QRgb(0x4d4d4f)));
- setTextColor(QColor(QRgb(0xffffff)));
- setTextBackgroundColor(QColor(0x4d, 0x4d, 0x4f, 0xcd));
- setGridLineColor(QColor(QRgb(0x3e3e40)));
- setSingleHighlightColor(QColor(QRgb(0xfbf6d6)));
- setMultiHighlightColor(QColor(QRgb(0x442f20)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(true);
- setColorStyle(Q3DTheme::ColorStyleUniform);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0xfbf6d6)), defaultColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0x442f20)), defaultColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0x4d4d4f)));
+ setWindowColor(theme, QColor(QRgb(0x4d4d4f)));
+ setTextColor(theme, QColor(QRgb(0xffffff)));
+ setTextBackgroundColor(theme, QColor(0x4d, 0x4d, 0x4f, 0xcd));
+ setGridLineColor(theme, QColor(QRgb(0x3e3e40)));
+ setSingleHighlightColor(theme, QColor(QRgb(0xfbf6d6)));
+ setMultiHighlightColor(theme, QColor(QRgb(0x442f20)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, true);
+ setColorStyle(theme, Q3DTheme::ColorStyleUniform);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0xfbf6d6)),
+ defaultColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0x442f20)),
+ defaultColorLevel));
break;
}
case Q3DTheme::ThemeArmyBlue: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0x495f76)));
baseColors.append(QColor(QRgb(0x81909f)));
baseColors.append(QColor(QRgb(0xbec5cd)));
baseColors.append(QColor(QRgb(0x687a8d)));
baseColors.append(QColor(QRgb(0xa3aeb9)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultBuiltInColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0xd5d6d7)));
- setWindowColor(QColor(QRgb(0xd5d6d7)));
- setTextColor(QColor(QRgb(0x000000)));
- setTextBackgroundColor(QColor(0xd5, 0xd6, 0xd7, 0xcd));
- setGridLineColor(QColor(QRgb(0xaeadac)));
- setSingleHighlightColor(QColor(QRgb(0x2aa2f9)));
- setMultiHighlightColor(QColor(QRgb(0x103753)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(false);
- setColorStyle(Q3DTheme::ColorStyleObjectGradient);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0x2aa2f9)), defaultBuiltInColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0x103753)), defaultBuiltInColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0xd5d6d7)));
+ setWindowColor(theme, QColor(QRgb(0xd5d6d7)));
+ setTextColor(theme, QColor(QRgb(0x000000)));
+ setTextBackgroundColor(theme, QColor(0xd5, 0xd6, 0xd7, 0xcd));
+ setGridLineColor(theme, QColor(QRgb(0xaeadac)));
+ setSingleHighlightColor(theme, QColor(QRgb(0x2aa2f9)));
+ setMultiHighlightColor(theme, QColor(QRgb(0x103753)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, false);
+ setColorStyle(theme, Q3DTheme::ColorStyleObjectGradient);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0x2aa2f9)),
+ defaultBuiltInColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0x103753)),
+ defaultBuiltInColorLevel));
break;
}
case Q3DTheme::ThemeRetro: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0x533b23)));
baseColors.append(QColor(QRgb(0x83715a)));
baseColors.append(QColor(QRgb(0xb3a690)));
baseColors.append(QColor(QRgb(0x6b563e)));
baseColors.append(QColor(QRgb(0x9b8b75)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultBuiltInColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultBuiltInColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0xe9e2ce)));
- setWindowColor(QColor(QRgb(0xe9e2ce)));
- setTextColor(QColor(QRgb(0x000000)));
- setTextBackgroundColor(QColor(0xe9, 0xe2, 0xce, 0xc0));
- setGridLineColor(QColor(QRgb(0xd0c0b0)));
- setSingleHighlightColor(QColor(QRgb(0x8ea317)));
- setMultiHighlightColor(QColor(QRgb(0xc25708)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(false);
- setColorStyle(Q3DTheme::ColorStyleObjectGradient);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0x8ea317)), defaultBuiltInColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0xc25708)), defaultBuiltInColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0xe9e2ce)));
+ setWindowColor(theme, QColor(QRgb(0xe9e2ce)));
+ setTextColor(theme, QColor(QRgb(0x000000)));
+ setTextBackgroundColor(theme, QColor(0xe9, 0xe2, 0xce, 0xc0));
+ setGridLineColor(theme, QColor(QRgb(0xd0c0b0)));
+ setSingleHighlightColor(theme, QColor(QRgb(0x8ea317)));
+ setMultiHighlightColor(theme, QColor(QRgb(0xc25708)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, false);
+ setColorStyle(theme, Q3DTheme::ColorStyleObjectGradient);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0x8ea317)),
+ defaultBuiltInColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0xc25708)),
+ defaultBuiltInColorLevel));
break;
}
case Q3DTheme::ThemeEbony: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0xffffff)));
baseColors.append(QColor(QRgb(0x999999)));
baseColors.append(QColor(QRgb(0x474747)));
baseColors.append(QColor(QRgb(0xc7c7c7)));
baseColors.append(QColor(QRgb(0x6b6b6b)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0x000000)));
- setWindowColor(QColor(QRgb(0x000000)));
- setTextColor(QColor(QRgb(0xaeadac)));
- setTextBackgroundColor(QColor(0x00, 0x00, 0x00, 0xcd));
- setGridLineColor(QColor(QRgb(0x35322f)));
- setSingleHighlightColor(QColor(QRgb(0xf5dc0d)));
- setMultiHighlightColor(QColor(QRgb(0xd72222)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(false);
- setColorStyle(Q3DTheme::ColorStyleUniform);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0xf5dc0d)), defaultColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0xd72222)), defaultColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0x000000)));
+ setWindowColor(theme, QColor(QRgb(0x000000)));
+ setTextColor(theme, QColor(QRgb(0xaeadac)));
+ setTextBackgroundColor(theme, QColor(0x00, 0x00, 0x00, 0xcd));
+ setGridLineColor(theme, QColor(QRgb(0x35322f)));
+ setSingleHighlightColor(theme, QColor(QRgb(0xf5dc0d)));
+ setMultiHighlightColor(theme, QColor(QRgb(0xd72222)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, false);
+ setColorStyle(theme, Q3DTheme::ColorStyleUniform);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0xf5dc0d)),
+ defaultColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0xd72222)),
+ defaultColorLevel));
break;
}
case Q3DTheme::ThemeIsabelle: {
- QList<QColor> baseColors;
baseColors.append(QColor(QRgb(0xf9d900)));
baseColors.append(QColor(QRgb(0xf09603)));
baseColors.append(QColor(QRgb(0xe85506)));
baseColors.append(QColor(QRgb(0xf5b802)));
baseColors.append(QColor(QRgb(0xec7605)));
- QList<QLinearGradient> baseGradients;
baseGradients.append(createGradient(baseColors.at(0), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(1), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(2), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(3), defaultColorLevel));
baseGradients.append(createGradient(baseColors.at(4), defaultColorLevel));
- setBackgroundEnabled(true);
- setGridEnabled(true);
- setFont(QFont(QStringLiteral("Arial")));
- setLabelBackgroundEnabled(true);
- setLightColor(Qt::white);
- setBaseColors(baseColors);
- setBackgroundColor(QColor(QRgb(0x000000)));
- setWindowColor(QColor(QRgb(0x000000)));
- setTextColor(QColor(QRgb(0xaeadac)));
- setTextBackgroundColor(QColor(0x00, 0x00, 0x00, 0xc0));
- setGridLineColor(QColor(QRgb(0x35322f)));
- setSingleHighlightColor(QColor(QRgb(0xfff7cc)));
- setMultiHighlightColor(QColor(QRgb(0xde0a0a)));
- setLightStrength(5.0f);
- setAmbientLightStrength(0.5f);
- setHighlightLightStrength(5.0f);
- setLabelBorderEnabled(false);
- setColorStyle(Q3DTheme::ColorStyleUniform);
- setBaseGradients(baseGradients);
- setSingleHighlightGradient(createGradient(QColor(QRgb(0xfff7cc)), defaultColorLevel));
- setMultiHighlightGradient(createGradient(QColor(QRgb(0xde0a0a)), defaultColorLevel));
+ setBackgroundEnabled(theme, true);
+ setGridEnabled(theme, true);
+ setFont(theme, QFont(QStringLiteral("Arial")));
+ setLabelBackgroundEnabled(theme, true);
+ setLightColor(theme, Qt::white);
+ setBaseColors(theme, baseColors);
+ setBackgroundColor(theme, QColor(QRgb(0x000000)));
+ setWindowColor(theme, QColor(QRgb(0x000000)));
+ setTextColor(theme, QColor(QRgb(0xaeadac)));
+ setTextBackgroundColor(theme, QColor(0x00, 0x00, 0x00, 0xc0));
+ setGridLineColor(theme, QColor(QRgb(0x35322f)));
+ setSingleHighlightColor(theme, QColor(QRgb(0xfff7cc)));
+ setMultiHighlightColor(theme, QColor(QRgb(0xde0a0a)));
+ setLightStrength(theme, 5.0f);
+ setAmbientLightStrength(theme, 0.5f);
+ setHighlightLightStrength(theme, 5.0f);
+ setLabelBorderEnabled(theme, false);
+ setColorStyle(theme, Q3DTheme::ColorStyleUniform);
+ setBaseGradients(theme, baseGradients);
+ setSingleHighlightGradient(theme, createGradient(QColor(QRgb(0xfff7cc)),
+ defaultColorLevel));
+ setMultiHighlightGradient(theme, createGradient(QColor(QRgb(0xde0a0a)),
+ defaultColorLevel));
break;
}
default:
@@ -468,130 +464,130 @@ QLinearGradient ThemeManager::createGradient(const QColor &color, float colorLev
return gradient;
}
-void ThemeManager::setBaseColors(const QList<QColor> &colors)
+void ThemeManager::setBaseColors(Q3DTheme *theme, const QList<QColor> &colors)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.baseColorDirty)
- m_activeTheme->setBaseColors(colors);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.baseColorDirty)
+ theme->setBaseColors(colors);
}
-void ThemeManager::setBackgroundColor(const QColor &color)
+void ThemeManager::setBackgroundColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.backgroundColorDirty)
- m_activeTheme->setBackgroundColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.backgroundColorDirty)
+ theme->setBackgroundColor(color);
}
-void ThemeManager::setWindowColor(const QColor &color)
+void ThemeManager::setWindowColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.windowColorDirty)
- m_activeTheme->setWindowColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.windowColorDirty)
+ theme->setWindowColor(color);
}
-void ThemeManager::setTextColor(const QColor &color)
+void ThemeManager::setTextColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.labelTextColorDirty)
- m_activeTheme->setLabelTextColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.labelTextColorDirty)
+ theme->setLabelTextColor(color);
}
-void ThemeManager::setTextBackgroundColor(const QColor &color)
+void ThemeManager::setTextBackgroundColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.labelBackgroundColorDirty)
- m_activeTheme->setLabelBackgroundColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.labelBackgroundColorDirty)
+ theme->setLabelBackgroundColor(color);
}
-void ThemeManager::setGridLineColor(const QColor &color)
+void ThemeManager::setGridLineColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.gridLineColorDirty)
- m_activeTheme->setGridLineColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.gridLineColorDirty)
+ theme->setGridLineColor(color);
}
-void ThemeManager::setSingleHighlightColor(const QColor &color)
+void ThemeManager::setSingleHighlightColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.singleHighlightColorDirty)
- m_activeTheme->setSingleHighlightColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.singleHighlightColorDirty)
+ theme->setSingleHighlightColor(color);
}
-void ThemeManager::setMultiHighlightColor(const QColor &color)
+void ThemeManager::setMultiHighlightColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.multiHighlightColorDirty)
- m_activeTheme->setMultiHighlightColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.multiHighlightColorDirty)
+ theme->setMultiHighlightColor(color);
}
-void ThemeManager::setLightColor(const QColor &color)
+void ThemeManager::setLightColor(Q3DTheme *theme, const QColor &color)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.lightColorDirty)
- m_activeTheme->setLightColor(color);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.lightColorDirty)
+ theme->setLightColor(color);
}
-void ThemeManager::setBaseGradients(const QList<QLinearGradient> &gradients)
+void ThemeManager::setBaseGradients(Q3DTheme *theme, const QList<QLinearGradient> &gradients)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.baseGradientDirty)
- m_activeTheme->setBaseGradients(gradients);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.baseGradientDirty)
+ theme->setBaseGradients(gradients);
}
-void ThemeManager::setSingleHighlightGradient(const QLinearGradient &gradient)
+void ThemeManager::setSingleHighlightGradient(Q3DTheme *theme, const QLinearGradient &gradient)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.singleHighlightGradientDirty)
- m_activeTheme->setSingleHighlightGradient(gradient);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.singleHighlightGradientDirty)
+ theme->setSingleHighlightGradient(gradient);
}
-void ThemeManager::setMultiHighlightGradient(const QLinearGradient &gradient)
+void ThemeManager::setMultiHighlightGradient(Q3DTheme *theme, const QLinearGradient &gradient)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.multiHighlightGradientDirty)
- m_activeTheme->setMultiHighlightGradient(gradient);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.multiHighlightGradientDirty)
+ theme->setMultiHighlightGradient(gradient);
}
-void ThemeManager::setLightStrength(float strength)
+void ThemeManager::setLightStrength(Q3DTheme *theme, float strength)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.lightStrengthDirty)
- m_activeTheme->setLightStrength(strength);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.lightStrengthDirty)
+ theme->setLightStrength(strength);
}
-void ThemeManager::setAmbientLightStrength(float strength)
+void ThemeManager::setAmbientLightStrength(Q3DTheme *theme, float strength)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.ambientLightStrengthDirty)
- m_activeTheme->setAmbientLightStrength(strength);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.ambientLightStrengthDirty)
+ theme->setAmbientLightStrength(strength);
}
-void ThemeManager::setHighlightLightStrength(float strength)
+void ThemeManager::setHighlightLightStrength(Q3DTheme *theme, float strength)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.highlightLightStrengthDirty)
- m_activeTheme->setHighlightLightStrength(strength);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.highlightLightStrengthDirty)
+ theme->setHighlightLightStrength(strength);
}
-void ThemeManager::setLabelBorderEnabled(bool enabled)
+void ThemeManager::setLabelBorderEnabled(Q3DTheme *theme, bool enabled)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.labelBorderEnabledDirty)
- m_activeTheme->setLabelBorderEnabled(enabled);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.labelBorderEnabledDirty)
+ theme->setLabelBorderEnabled(enabled);
}
-void ThemeManager::setFont(const QFont &font)
+void ThemeManager::setFont(Q3DTheme *theme, const QFont &font)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.fontDirty)
- m_activeTheme->setFont(font);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.fontDirty)
+ theme->setFont(font);
}
-void ThemeManager::setBackgroundEnabled(bool enabled)
+void ThemeManager::setBackgroundEnabled(Q3DTheme *theme, bool enabled)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.backgroundEnabledDirty)
- m_activeTheme->setBackgroundEnabled(enabled);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.backgroundEnabledDirty)
+ theme->setBackgroundEnabled(enabled);
}
-void ThemeManager::setGridEnabled(bool enabled)
+void ThemeManager::setGridEnabled(Q3DTheme *theme, bool enabled)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.gridEnabledDirty)
- m_activeTheme->setGridEnabled(enabled);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.gridEnabledDirty)
+ theme->setGridEnabled(enabled);
}
-void ThemeManager::setLabelBackgroundEnabled(bool enabled)
+void ThemeManager::setLabelBackgroundEnabled(Q3DTheme *theme, bool enabled)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.labelBackgroundEnabledDirty)
- m_activeTheme->setLabelBackgroundEnabled(enabled);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.labelBackgroundEnabledDirty)
+ theme->setLabelBackgroundEnabled(enabled);
}
-void ThemeManager::setColorStyle(Q3DTheme::ColorStyle style)
+void ThemeManager::setColorStyle(Q3DTheme *theme, Q3DTheme::ColorStyle style)
{
- if (!m_activeTheme->d_ptr->m_dirtyBits.colorStyleDirty)
- m_activeTheme->setColorStyle(style);
+ if (theme->d_ptr->isForcePredefinedType() || !theme->d_ptr->m_dirtyBits.colorStyleDirty)
+ theme->setColorStyle(style);
}
QT_DATAVISUALIZATION_END_NAMESPACE
diff --git a/src/datavisualization/theme/thememanager_p.h b/src/datavisualization/theme/thememanager_p.h
index 254bb7bf..13cbcdc9 100644
--- a/src/datavisualization/theme/thememanager_p.h
+++ b/src/datavisualization/theme/thememanager_p.h
@@ -48,31 +48,32 @@ public:
Q3DTheme *activeTheme() const;
QList<Q3DTheme *> themes() const;
+ static void setPredefinedPropertiesToTheme(Q3DTheme *theme, Q3DTheme::Theme type);
+
protected:
void connectThemeSignals();
- void useTheme(Q3DTheme::Theme type);
- QLinearGradient createGradient(const QColor &color, float colorLevel);
- void setBaseColors(const QList<QColor> &colors);
- void setBackgroundColor(const QColor &color);
- void setWindowColor(const QColor &color);
- void setTextColor(const QColor &color);
- void setTextBackgroundColor(const QColor &color);
- void setGridLineColor(const QColor &color);
- void setSingleHighlightColor(const QColor &color);
- void setMultiHighlightColor(const QColor &color);
- void setLightColor(const QColor &color);
- void setBaseGradients(const QList<QLinearGradient> &gradients);
- void setSingleHighlightGradient(const QLinearGradient &gradient);
- void setMultiHighlightGradient(const QLinearGradient &gradient);
- void setLightStrength(float strength);
- void setAmbientLightStrength(float strength);
- void setHighlightLightStrength(float strength);
- void setLabelBorderEnabled(bool enabled);
- void setFont(const QFont &font);
- void setBackgroundEnabled(bool enabled);
- void setGridEnabled(bool enabled);
- void setLabelBackgroundEnabled(bool enabled);
- void setColorStyle(Q3DTheme::ColorStyle style);
+ static QLinearGradient createGradient(const QColor &color, float colorLevel);
+ static void setBaseColors(Q3DTheme *theme, const QList<QColor> &colors);
+ static void setBackgroundColor(Q3DTheme *theme, const QColor &color);
+ static void setWindowColor(Q3DTheme *theme, const QColor &color);
+ static void setTextColor(Q3DTheme *theme, const QColor &color);
+ static void setTextBackgroundColor(Q3DTheme *theme, const QColor &color);
+ static void setGridLineColor(Q3DTheme *theme, const QColor &color);
+ static void setSingleHighlightColor(Q3DTheme *theme, const QColor &color);
+ static void setMultiHighlightColor(Q3DTheme *theme, const QColor &color);
+ static void setLightColor(Q3DTheme *theme, const QColor &color);
+ static void setBaseGradients(Q3DTheme *theme, const QList<QLinearGradient> &gradients);
+ static void setSingleHighlightGradient(Q3DTheme *theme, const QLinearGradient &gradient);
+ static void setMultiHighlightGradient(Q3DTheme *theme, const QLinearGradient &gradient);
+ static void setLightStrength(Q3DTheme *theme, float strength);
+ static void setAmbientLightStrength(Q3DTheme *theme, float strength);
+ static void setHighlightLightStrength(Q3DTheme *theme, float strength);
+ static void setLabelBorderEnabled(Q3DTheme *theme, bool enabled);
+ static void setFont(Q3DTheme *theme, const QFont &font);
+ static void setBackgroundEnabled(Q3DTheme *theme, bool enabled);
+ static void setGridEnabled(Q3DTheme *theme, bool enabled);
+ static void setLabelBackgroundEnabled(Q3DTheme *theme, bool enabled);
+ static void setColorStyle(Q3DTheme *theme, Q3DTheme::ColorStyle style);
private:
Q3DTheme *m_activeTheme;