summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-07 10:46:26 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-07 13:18:41 +0200
commit8566d712a87d9e3a78be15b6bd3498c2cf8afe57 (patch)
tree6ae292f0fd8c870d997db6d208a531da5f9320f0
parentaa842c39480aa5b95f704c97b8b3acc821144883 (diff)
Fix setting theme type
Now reset the theme properties immediately to new theme type, instead of waiting for the theme activation. Also make changing theme type later work consistently. Task-number: QTRD-2750 Change-Id: I970d69587623119df33ad2a825fbc12367804eae Reviewed-by: Mika Salmela <mika.salmela@digia.com>
-rw-r--r--examples/audiolevels/audiolevels.cpp2
-rw-r--r--examples/bars/graphmodifier.cpp5
-rw-r--r--examples/custominput/scatterdatamodifier.cpp2
-rw-r--r--examples/customproxy/rainfallgraph.cpp2
-rw-r--r--examples/itemmodel/main.cpp2
-rw-r--r--examples/qmlscatter/qml/qmlscatter/main.qml7
-rw-r--r--examples/scatter/scatterdatamodifier.cpp7
-rw-r--r--examples/surface/doc/src/surface.qdoc3
-rw-r--r--examples/surface/surfacegraph.cpp5
-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
-rw-r--r--src/datavisualizationqml2/declarativetheme.cpp15
-rw-r--r--src/datavisualizationqml2/declarativetheme_p.h11
-rw-r--r--tests/barstest/chart.cpp18
-rw-r--r--tests/barstest/chart.h1
-rw-r--r--tests/multigraphs/data.cpp16
-rw-r--r--tests/scattertest/scatterchart.cpp7
-rw-r--r--tests/surfacetest/graphmodifier.cpp5
-rw-r--r--tests/surfacetest/main.cpp2
24 files changed, 376 insertions, 353 deletions
diff --git a/examples/audiolevels/audiolevels.cpp b/examples/audiolevels/audiolevels.cpp
index 259274d9..33a0be3b 100644
--- a/examples/audiolevels/audiolevels.cpp
+++ b/examples/audiolevels/audiolevels.cpp
@@ -46,7 +46,7 @@ AudioLevels::AudioLevels(Q3DBars *graph, QObject *parent)
m_graph->setShadowQuality(QDataVis::ShadowQualityNone);
m_graph->setSelectionMode(QDataVis::SelectionNone);
m_graph->scene()->activeCamera()->setCameraPosition(-25.0f, 10.0f, 190.0f);
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeIsabelle);
m_graph->activeTheme()->setGridEnabled(true);
m_graph->activeTheme()->setBackgroundEnabled(false);
QFont font = m_graph->activeTheme()->font();
diff --git a/examples/bars/graphmodifier.cpp b/examples/bars/graphmodifier.cpp
index 09fec65d..fddc385e 100644
--- a/examples/bars/graphmodifier.cpp
+++ b/examples/bars/graphmodifier.cpp
@@ -186,10 +186,7 @@ void GraphModifier::changePresetCamera()
void GraphModifier::changeTheme(int theme)
{
Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- currentTheme = new Q3DTheme(Q3DTheme::Theme(theme));
- m_graph->setActiveTheme(currentTheme);
+ currentTheme->setType(Q3DTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
emit fontChanged(currentTheme->font());
diff --git a/examples/custominput/scatterdatamodifier.cpp b/examples/custominput/scatterdatamodifier.cpp
index aeef4c98..acdf3e8d 100644
--- a/examples/custominput/scatterdatamodifier.cpp
+++ b/examples/custominput/scatterdatamodifier.cpp
@@ -32,7 +32,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
: m_graph(scatter),
m_inputHandler(new CustomInputHandler())
{
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeDigia));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeDigia);
m_graph->setShadowQuality(QDataVis::ShadowQualityMedium);
m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetFront);
diff --git a/examples/customproxy/rainfallgraph.cpp b/examples/customproxy/rainfallgraph.cpp
index 57e1d0ea..0fd91419 100644
--- a/examples/customproxy/rainfallgraph.cpp
+++ b/examples/customproxy/rainfallgraph.cpp
@@ -72,7 +72,7 @@ RainfallGraph::RainfallGraph(Q3DBars *rainfall)
m_graph->setSelectionMode(QDataVis::SelectionItemAndColumn | QDataVis::SelectionSlice);
// Set theme
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeArmyBlue));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeArmyBlue);
// Set font to theme
m_graph->activeTheme()->setFont(QFont("Century Gothic", 30));
diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp
index 015470d1..8cec91ba 100644
--- a/examples/itemmodel/main.cpp
+++ b/examples/itemmodel/main.cpp
@@ -107,7 +107,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid
//! [7]
// Set theme
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeDigia));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeDigia);
// Set font
m_graph->activeTheme()->setFont(QFont("Impact", 20));
diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml
index 50164c50..b3ea5f07 100644
--- a/examples/qmlscatter/qml/qmlscatter/main.qml
+++ b/examples/qmlscatter/qml/qmlscatter/main.qml
@@ -44,7 +44,7 @@ Item {
//! [13]
Theme3D {
- id : themeArmyBlue
+ id: themeArmyBlue
type: Theme3D.ThemeArmyBlue
}
@@ -194,6 +194,11 @@ Item {
} else {
scatterGraph.theme = themeArmyBlue
}
+ if (scatterGraph.theme.backgroundEnabled === true) {
+ backgroundToggle.text = "Hide Background";
+ } else {
+ backgroundToggle.text = "Show Background";
+ }
}
}
diff --git a/examples/scatter/scatterdatamodifier.cpp b/examples/scatter/scatterdatamodifier.cpp
index 964da977..ade34da4 100644
--- a/examples/scatter/scatterdatamodifier.cpp
+++ b/examples/scatter/scatterdatamodifier.cpp
@@ -39,7 +39,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
m_smooth(true)
{
//! [0]
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeEbony));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeEbony);
QFont font = m_graph->activeTheme()->font();
font.setPointSize(m_fontSize);
m_graph->activeTheme()->setFont(font);
@@ -132,10 +132,7 @@ void ScatterDataModifier::setSmoothDots(int smooth)
void ScatterDataModifier::changeTheme(int theme)
{
Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- currentTheme = new Q3DTheme(Q3DTheme::Theme(theme));
- m_graph->setActiveTheme(currentTheme);
+ currentTheme->setType(Q3DTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
emit fontChanged(currentTheme->font());
diff --git a/examples/surface/doc/src/surface.qdoc b/examples/surface/doc/src/surface.qdoc
index dd334d01..d34c075e 100644
--- a/examples/surface/doc/src/surface.qdoc
+++ b/examples/surface/doc/src/surface.qdoc
@@ -124,7 +124,8 @@
Q3DSurface supports all the themes Qt Data Visualization has. The example has a pull
down menu for selecting the theme. The following method is connected to the
- menu to activate the selected theme. The old theme is released and deleted:
+ menu to activate the selected theme. The theme type is changed to another predefined theme,
+ which overwrites all theme properties to predefined values:
\snippet ../examples/surface/surfacegraph.cpp 6
diff --git a/examples/surface/surfacegraph.cpp b/examples/surface/surfacegraph.cpp
index 3770906e..a3d2b60e 100644
--- a/examples/surface/surfacegraph.cpp
+++ b/examples/surface/surfacegraph.cpp
@@ -229,10 +229,7 @@ void SurfaceGraph::setAxisZRange(float min, float max)
//! [6]
void SurfaceGraph::changeTheme(int theme)
{
- Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
+ m_graph->activeTheme()->setType(Q3DTheme::Theme(theme));
}
//! [6]
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;
diff --git a/src/datavisualizationqml2/declarativetheme.cpp b/src/datavisualizationqml2/declarativetheme.cpp
index 6c804397..c494052a 100644
--- a/src/datavisualizationqml2/declarativetheme.cpp
+++ b/src/datavisualizationqml2/declarativetheme.cpp
@@ -150,6 +150,19 @@ ColorGradient *DeclarativeTheme3D::multiHighlightGradient() const
return m_multiHLGradient;
}
+void DeclarativeTheme3D::classBegin()
+{
+ // Turn off predefined type forcing for the duration of initial class construction
+ // so that predefined type customization can be done.
+ d_ptr->setForcePredefinedType(false);
+}
+
+void DeclarativeTheme3D::componentComplete()
+{
+ d_ptr->setForcePredefinedType(true);
+}
+
+
void DeclarativeTheme3D::setThemeGradient(ColorGradient *gradient, GradientType type)
{
QLinearGradient newGradient = convertGradient(gradient);
@@ -217,7 +230,7 @@ void DeclarativeTheme3D::addColor(DeclarativeColor *color)
QList<DeclarativeColor *> DeclarativeTheme3D::colorList()
{
if (m_colors.isEmpty()) {
- // Create dummy ThemeColors from theme's gradients
+ // Create dummy ThemeColors from theme's colors
m_dummyColors = true;
QList<QColor> list = Q3DTheme::baseColors();
foreach (QColor item, list) {
diff --git a/src/datavisualizationqml2/declarativetheme_p.h b/src/datavisualizationqml2/declarativetheme_p.h
index 79c1f5c9..0ec0d1ef 100644
--- a/src/datavisualizationqml2/declarativetheme_p.h
+++ b/src/datavisualizationqml2/declarativetheme_p.h
@@ -32,13 +32,16 @@
#include "datavisualizationglobal_p.h"
#include "declarativecolor_p.h"
#include "colorgradient_p.h"
-#include "q3dtheme.h"
+#include "q3dtheme_p.h"
+
+#include <QtQml/qqmlparserstatus.h>
QT_DATAVISUALIZATION_BEGIN_NAMESPACE
-class DeclarativeTheme3D : public Q3DTheme
+class DeclarativeTheme3D : public Q3DTheme, public QQmlParserStatus
{
Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
Q_PROPERTY(QQmlListProperty<DeclarativeColor> baseColors READ baseColors)
Q_PROPERTY(QQmlListProperty<ColorGradient> baseGradients READ baseGradients)
@@ -73,6 +76,10 @@ public:
void setMultiHighlightGradient(ColorGradient *gradient);
ColorGradient *multiHighlightGradient() const;
+ // From QQmlParserStatus
+ virtual void classBegin();
+ virtual void componentComplete();
+
signals:
void singleHighlightGradientChanged(ColorGradient *gradient);
void multiHighlightGradientChanged(ColorGradient *gradient);
diff --git a/tests/barstest/chart.cpp b/tests/barstest/chart.cpp
index 5c36607e..73f0074c 100644
--- a/tests/barstest/chart.cpp
+++ b/tests/barstest/chart.cpp
@@ -64,7 +64,8 @@ GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog)
m_negativeValuesOn(false),
m_useNullInputHandler(false),
m_defaultInputHandler(0),
- m_ownTheme(0)
+ m_ownTheme(0),
+ m_builtinTheme(new Q3DTheme(Q3DTheme::ThemeStoneMoss))
{
// Generate generic labels
QStringList genericColumnLabels;
@@ -117,7 +118,7 @@ GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog)
m_graph->addAxis(m_genericRowAxis);
m_graph->addAxis(m_genericColumnAxis);
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeStoneMoss));
+ m_graph->setActiveTheme(m_builtinTheme);
m_graph->setShadowQuality(QDataVis::ShadowQualitySoftMedium);
m_temperatureData->setItemLabelFormat(QStringLiteral("1: @valueTitle for @colLabel @rowLabel: @valueLabel"));
@@ -578,11 +579,9 @@ void GraphModifier::changeTheme()
static int theme = Q3DTheme::ThemeQt;
Q3DTheme *currentTheme = m_graph->activeTheme();
- if (currentTheme != m_ownTheme) {
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- }
- m_graph->setActiveTheme(new Q3DTheme((Q3DTheme::Theme)theme));
+ m_builtinTheme->setType(Q3DTheme::Theme(theme));
+ if (currentTheme == m_ownTheme)
+ m_graph->setActiveTheme(m_builtinTheme);
switch (theme) {
case Q3DTheme::ThemeQt:
@@ -851,11 +850,6 @@ void GraphModifier::useOwnTheme()
m_ownTheme->setWindowColor(QColor(QRgb(0xffffff)));
}
- Q3DTheme *currentTheme = m_graph->activeTheme();
- if (currentTheme != m_ownTheme) {
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- }
m_graph->setActiveTheme(m_ownTheme);
m_colorDialog->open();
diff --git a/tests/barstest/chart.h b/tests/barstest/chart.h
index 3948ca8f..77b10093 100644
--- a/tests/barstest/chart.h
+++ b/tests/barstest/chart.h
@@ -130,6 +130,7 @@ private:
bool m_useNullInputHandler;
QAbstract3DInputHandler *m_defaultInputHandler;
Q3DTheme *m_ownTheme;
+ Q3DTheme *m_builtinTheme;
};
#endif
diff --git a/tests/multigraphs/data.cpp b/tests/multigraphs/data.cpp
index 177d86b7..7ba5685f 100644
--- a/tests/multigraphs/data.cpp
+++ b/tests/multigraphs/data.cpp
@@ -45,7 +45,7 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars,
m_started(false)
{
// Initialize surface
- m_surface->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle));
+ m_surface->activeTheme()->setType(Q3DTheme::ThemeIsabelle);
QLinearGradient gradient;
gradient.setColorAt(0.0, Qt::black);
gradient.setColorAt(0.33, Qt::blue);
@@ -63,7 +63,7 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars,
m_surface->addSeries(series1);
// Initialize scatter
- m_scatter->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeStoneMoss));
+ m_scatter->activeTheme()->setType(Q3DTheme::ThemeStoneMoss);
m_scatter->setSelectionMode(QDataVis::SelectionNone);
m_scatter->activeTheme()->setGridEnabled(false);
m_scatter->setShadowQuality(QDataVis::ShadowQualitySoftLow);
@@ -73,7 +73,7 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars,
m_scatter->addSeries(series2);
// Initialize bars
- m_bars->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeQt));
+ m_bars->activeTheme()->setType(Q3DTheme::ThemeQt);
m_bars->setSelectionMode(QDataVis::SelectionItemAndRow | QDataVis::SelectionSlice);
m_bars->activeTheme()->setGridEnabled(false);
m_bars->setShadowQuality(QDataVis::ShadowQualityLow);
@@ -185,10 +185,7 @@ void Data::scrollDown()
void Data::useGradientOne()
{
- Q3DTheme *currentTheme = m_surface->activeTheme();
- m_surface->releaseTheme(currentTheme);
- delete currentTheme;
- m_surface->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle));
+ m_surface->activeTheme()->setType(Q3DTheme::ThemeIsabelle);
QLinearGradient gradient;
gradient.setColorAt(0.0, Qt::black);
gradient.setColorAt(0.33, Qt::blue);
@@ -201,10 +198,7 @@ void Data::useGradientOne()
void Data::useGradientTwo()
{
- Q3DTheme *currentTheme = m_surface->activeTheme();
- m_surface->releaseTheme(currentTheme);
- delete currentTheme;
- m_surface->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeQt));
+ m_surface->activeTheme()->setType(Q3DTheme::ThemeQt);
QLinearGradient gradient;
gradient.setColorAt(0.0, Qt::white);
gradient.setColorAt(0.8, Qt::red);
diff --git a/tests/scattertest/scatterchart.cpp b/tests/scattertest/scatterchart.cpp
index 10f48465..2277ca3f 100644
--- a/tests/scattertest/scatterchart.cpp
+++ b/tests/scattertest/scatterchart.cpp
@@ -37,7 +37,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
m_selectedItem(-1),
m_targetSeries(0)
{
- m_chart->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeStoneMoss));
+ m_chart->activeTheme()->setType(Q3DTheme::ThemeStoneMoss);
QFont font = m_chart->activeTheme()->font();
font.setPointSize(m_fontSize);
m_chart->activeTheme()->setFont(font);
@@ -161,10 +161,7 @@ void ScatterDataModifier::changeTheme()
{
static int theme = Q3DTheme::ThemeQt;
- Q3DTheme *currentTheme = m_chart->activeTheme();
- m_chart->releaseTheme(currentTheme);
- delete currentTheme;
- m_chart->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
+ m_chart->activeTheme()->setType(Q3DTheme::Theme(theme));
if (++theme > Q3DTheme::ThemeIsabelle)
theme = Q3DTheme::ThemeQt;
diff --git a/tests/surfacetest/graphmodifier.cpp b/tests/surfacetest/graphmodifier.cpp
index 749b1c69..be96a696 100644
--- a/tests/surfacetest/graphmodifier.cpp
+++ b/tests/surfacetest/graphmodifier.cpp
@@ -363,10 +363,7 @@ void GraphModifier::selectedPointChanged(const QPoint &point)
void GraphModifier::changeTheme(int theme)
{
- Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
+ m_graph->activeTheme()->setType(Q3DTheme::Theme(theme));
}
diff --git a/tests/surfacetest/main.cpp b/tests/surfacetest/main.cpp
index 5a26c7ce..54c27981 100644
--- a/tests/surfacetest/main.cpp
+++ b/tests/surfacetest/main.cpp
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
QSize screenSize = surfaceGraph->screen()->size();
// Set to default, should be same as the initial on themeList
- surfaceGraph->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(initialTheme)));
+ surfaceGraph->activeTheme()->setType(Q3DTheme::Theme(initialTheme));
QWidget *container = QWidget::createWindowContainer(surfaceGraph);
container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 2));