diff options
Diffstat (limited to 'src/datavisualization')
-rw-r--r-- | src/datavisualization/data/qabstract3dseries.cpp | 16 | ||||
-rw-r--r-- | src/datavisualization/engine/abstract3dcontroller.cpp | 14 | ||||
-rw-r--r-- | src/datavisualization/engine/abstract3dcontroller_p.h | 4 | ||||
-rw-r--r-- | src/datavisualization/engine/surface3drenderer.cpp | 2 | ||||
-rw-r--r-- | src/datavisualization/theme/q3dtheme.cpp | 103 | ||||
-rw-r--r-- | src/datavisualization/theme/q3dtheme.h | 16 | ||||
-rw-r--r-- | src/datavisualization/theme/q3dtheme_p.h | 4 | ||||
-rw-r--r-- | src/datavisualization/theme/thememanager.cpp | 82 | ||||
-rw-r--r-- | src/datavisualization/theme/thememanager_p.h | 4 |
9 files changed, 152 insertions, 93 deletions
diff --git a/src/datavisualization/data/qabstract3dseries.cpp b/src/datavisualization/data/qabstract3dseries.cpp index 46224813..6126d774 100644 --- a/src/datavisualization/data/qabstract3dseries.cpp +++ b/src/datavisualization/data/qabstract3dseries.cpp @@ -102,7 +102,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * \qmlproperty Color Abstract3DSeries::baseColor * * Sets the base \c color of the series. - * See \l{Theme3D::baseColor}{Theme3D.baseColor} + * See \l{Theme3D::baseColors}{Theme3D.baseColors} * documentation for more information. * * \sa colorStyle @@ -112,7 +112,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * \qmlproperty ColorGradient Abstract3DSeries::baseGradient * * Sets the base \c gradient of the series. - * See \l{Theme3D::baseGradient}{Theme3D.baseGradient} + * See \l{Theme3D::baseGradients}{Theme3D.baseGradients} * documentation for more information. * * \sa colorStyle @@ -628,19 +628,21 @@ void QAbstract3DSeriesPrivate::setMultiHighlightGradient(const QLinearGradient & void QAbstract3DSeriesPrivate::resetToTheme(const Q3DTheme &theme, int seriesIndex, bool force) { - // TODO: seriesIndex indicates which color from theme is required - Q_UNUSED(seriesIndex) - + int themeIndex = seriesIndex; if (force || !m_themeTracker.colorStyleOverride) { q_ptr->setColorStyle(theme.colorStyle()); m_themeTracker.colorStyleOverride = false; } if (force || !m_themeTracker.baseColorOverride) { - q_ptr->setBaseColor(theme.baseColor()); + if (theme.baseColors().size() <= seriesIndex) + themeIndex = seriesIndex % theme.baseColors().size(); + q_ptr->setBaseColor(theme.baseColors().at(themeIndex)); m_themeTracker.baseColorOverride = false; } if (force || !m_themeTracker.baseGradientOverride) { - q_ptr->setBaseGradient(theme.baseGradient()); + if (theme.baseGradients().size() <= seriesIndex) + themeIndex = seriesIndex % theme.baseGradients().size(); + q_ptr->setBaseGradient(theme.baseGradients().at(themeIndex)); m_themeTracker.baseGradientOverride = false; } if (force || !m_themeTracker.singleHighlightColorOverride) { diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp index a1ad9191..09fa8510 100644 --- a/src/datavisualization/engine/abstract3dcontroller.cpp +++ b/src/datavisualization/engine/abstract3dcontroller.cpp @@ -474,26 +474,32 @@ void Abstract3DController::handleThemeColorStyleChanged(Q3DTheme::ColorStyle sty markSeriesVisualsDirty(); } -void Abstract3DController::handleThemeBaseColorChanged(const QColor &color) +void Abstract3DController::handleThemeBaseColorsChanged(const QList<QColor> &colors) { + int colorIdx = 0; // Set value for series that have not explicitly set this value foreach (QAbstract3DSeries *series, m_seriesList) { if (!series->d_ptr->m_themeTracker.baseColorOverride) { - series->setBaseColor(color); + series->setBaseColor(colors.at(colorIdx)); series->d_ptr->m_themeTracker.baseColorOverride = false; } + if (++colorIdx >= colors.size()) + colorIdx = 0; } markSeriesVisualsDirty(); } -void Abstract3DController::handleThemeBaseGradientChanged(const QLinearGradient &gradient) +void Abstract3DController::handleThemeBaseGradientsChanged(const QList<QLinearGradient> &gradients) { + int gradientIdx = 0; // Set value for series that have not explicitly set this value foreach (QAbstract3DSeries *series, m_seriesList) { if (!series->d_ptr->m_themeTracker.baseGradientOverride) { - series->setBaseGradient(gradient); + series->setBaseGradient(gradients.at(gradientIdx)); series->d_ptr->m_themeTracker.baseGradientOverride = false; } + if (++gradientIdx >= gradients.size()) + gradientIdx = 0; } markSeriesVisualsDirty(); } diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h index 934aa7f5..b8ad5daa 100644 --- a/src/datavisualization/engine/abstract3dcontroller_p.h +++ b/src/datavisualization/engine/abstract3dcontroller_p.h @@ -262,8 +262,8 @@ public slots: void handlePixelRatioChanged(float ratio); void handleThemeColorStyleChanged(Q3DTheme::ColorStyle style); - void handleThemeBaseColorChanged(const QColor &color); - void handleThemeBaseGradientChanged(const QLinearGradient &gradient); + void handleThemeBaseColorsChanged(const QList<QColor> &color); + void handleThemeBaseGradientsChanged(const QList<QLinearGradient> &gradient); void handleThemeSingleHighlightColorChanged(const QColor &color); void handleThemeSingleHighlightGradientChanged(const QLinearGradient &gradient); void handleThemeMultiHighlightColorChanged(const QColor &color); diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index f0dd5f3e..47e3bf08 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -2179,6 +2179,7 @@ void Surface3DRenderer::updateDepthBuffer() lowerShadowQuality(); } } +#endif void Surface3DRenderer::generateUniformGradient(const QVector3D newColor) { @@ -2192,6 +2193,5 @@ void Surface3DRenderer::generateUniformGradient(const QVector3D newColor) fixGradientAndGenerateTexture(&newGradient, &m_uniformGradientTexture); } } -#endif QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/theme/q3dtheme.cpp b/src/datavisualization/theme/q3dtheme.cpp index f138dfc1..8db30ec6 100644 --- a/src/datavisualization/theme/q3dtheme.cpp +++ b/src/datavisualization/theme/q3dtheme.cpp @@ -51,16 +51,19 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * \li Is the graph background drawn or not. * \li true * \row - * \li baseColor - * \li The color for the objects in the graph. The color in this property is used if colorStyle - * is ColorStyleUniform. This can be overridden by setting the baseColor explicitly in - * series. - * \li Qt::white + * \li baseColors + * \li List of colors for the objects in the graph. Colors are applied to series one by one. + * If there are more series than colors, the color list is reused from the start. + * The colors in this property are used if colorStyle is ColorStyleUniform. This can be + * overridden by setting the baseColor explicitly in series. + * \li Qt::black * \row - * \li baseGradient - * \li The gradient for the objects in the graph. The gradient in this property is used if - * colorStyle is ColorStyleObjectGradient or ColorStyleRangeGradient. This can be overridden - * by setting the baseGradient explicitly in series. + * \li baseGradients + * \li List of gradients for the objects in the graph. Gradients are applied to series one by + * one. If there are more series than gradients, the gradient list is reused from the start. + * The gradients in this property are used if colorStyle is ColorStyleObjectGradient or + * ColorStyleRangeGradient. This can be overridden by setting the baseGradient explicitly + * in series. * \li QLinearGradient(). Essentially fully black. * \row * \li colorStyle @@ -234,10 +237,11 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE */ /*! - * \qmlproperty Color Theme3D::baseColor + * \qmlproperty Color Theme3D::baseColors * - * Color to be used for all the objects in the graph. Has no immediate effect if colorStyle is not - * \c Theme3D.ColorStyleUniform. + * List of base colors to be used for all the objects in the graph, series by series. If there + * are more series than colors, color list wraps and starts again with the first color in the list. + * Has no immediate effect if colorStyle is not \c Theme3D.ColorStyleUniform. */ /*! @@ -293,10 +297,12 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE */ /*! - * \qmlproperty ColorGradient Theme3D::baseGradient + * \qmlproperty ColorGradient Theme3D::baseGradients * - * Base gradient to be used for all the objects in the graph. Has no immediate effect if colorStyle - * is \c Theme3D.ColorStyleUniform. + * List of base gradients to be used for all the objects in the graph, series by series. If there + * are more series than gradients, gradient list wraps and starts again with the first gradient in + * the list + * Has no immediate effect if colorStyle is \c Theme3D.ColorStyleUniform. */ /*! @@ -413,25 +419,30 @@ Q3DTheme::~Q3DTheme() } // TODO: Add needRenders if necessary after color api has been added to series (QTRD-2200/2557) -// TODO: Basecolors as a list, containing one for each series? /*! - * \property Q3DTheme::baseColor + * \property Q3DTheme::baseColors * - * Color to be used for all the objects in the graph. Has no immediate effect if colorStyle is not - * ColorStyleUniform. + * List of base colors to be used for all the objects in the graph, series by series. If there + * are more series than colors, color list wraps and starts again with the first color in the list. + * Has no immediate effect if colorStyle is not ColorStyleUniform. */ -void Q3DTheme::setBaseColor(const QColor &color) +void Q3DTheme::setBaseColors(const QList<QColor> &colors) { - d_ptr->m_dirtyBits.baseColorDirty = true; - if (d_ptr->m_baseColor != color) { - d_ptr->m_baseColor = color; - emit baseColorChanged(color); + if (colors.size()) { + d_ptr->m_dirtyBits.baseColorDirty = true; + if (d_ptr->m_baseColors != colors) { + d_ptr->m_baseColors.clear(); + d_ptr->m_baseColors = colors; + emit baseColorsChanged(colors); + } + } else { + d_ptr->m_baseColors.clear(); } } -QColor Q3DTheme::baseColor() const +QList<QColor> Q3DTheme::baseColors() const { - return d_ptr->m_baseColor; + return d_ptr->m_baseColors; } /*! @@ -596,25 +607,31 @@ QColor Q3DTheme::lightColor() const return d_ptr->m_lightColor; } -// TODO: Surfacegradients as a list, containing one for each series? /*! - * \property Q3DTheme::baseGradient + * \property Q3DTheme::baseGradients * - * Base gradient to be used for all the objects in the graph. Has no immediate effect if colorStyle - * is ColorStyleUniform. + * List of base gradients to be used for all the objects in the graph, series by series. If there + * are more series than gradients, gradient list wraps and starts again with the first gradient in + * the list + * Has no immediate effect if colorStyle is ColorStyleUniform. */ -void Q3DTheme::setBaseGradient(const QLinearGradient &gradient) +void Q3DTheme::setBaseGradients(const QList<QLinearGradient> &gradients) { - d_ptr->m_dirtyBits.baseGradientDirty = true; - if (d_ptr->m_baseGradient != gradient) { - d_ptr->m_baseGradient = gradient; - emit baseGradientChanged(gradient); + if (gradients.size()) { + d_ptr->m_dirtyBits.baseGradientDirty = true; + if (d_ptr->m_baseGradients != gradients) { + d_ptr->m_baseGradients.clear(); + d_ptr->m_baseGradients = gradients; + emit baseGradientsChanged(gradients); + } + } else { + d_ptr->m_baseGradients.clear(); } } -QLinearGradient Q3DTheme::baseGradient() const +QList<QLinearGradient> Q3DTheme::baseGradients() const { - return d_ptr->m_baseGradient; + return d_ptr->m_baseGradients; } /*! @@ -867,7 +884,6 @@ Q3DTheme::Theme Q3DTheme::type() const Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, Q3DTheme::Theme theme_id) : QObject(0), m_themeId(theme_id), - m_baseColor(Qt::white), m_backgroundColor(Qt::black), m_windowColor(Qt::black), m_textColor(Qt::white), @@ -876,9 +892,6 @@ Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, Q3DTheme::Theme theme_id) m_singleHighlightColor(Qt::red), m_multiHighlightColor(Qt::blue), m_lightColor(Qt::white), - m_baseGradient(QLinearGradient(qreal(gradientTextureWidth), - qreal(gradientTextureHeight), - 0.0, 0.0)), m_singleHighlightGradient(QLinearGradient(qreal(gradientTextureWidth), qreal(gradientTextureHeight), 0.0, 0.0)), @@ -896,6 +909,10 @@ Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, Q3DTheme::Theme theme_id) m_labelBackground(true), q_ptr(q) { + m_baseColors.append(QColor(Qt::black)); + m_baseGradients.append(QLinearGradient(qreal(gradientTextureWidth), + qreal(gradientTextureHeight), + 0.0, 0.0)); } Q3DThemePrivate::~Q3DThemePrivate() @@ -947,12 +964,12 @@ bool Q3DThemePrivate::sync(Q3DThemePrivate &other) changed = true; } if (m_dirtyBits.baseColorDirty) { - other.q_ptr->setBaseColor(m_baseColor); + other.q_ptr->setBaseColors(m_baseColors); m_dirtyBits.baseColorDirty = false; changed = true; } if (m_dirtyBits.baseGradientDirty) { - other.q_ptr->setBaseGradient(m_baseGradient); + other.q_ptr->setBaseGradients(m_baseGradients); m_dirtyBits.baseGradientDirty = false; changed = true; } diff --git a/src/datavisualization/theme/q3dtheme.h b/src/datavisualization/theme/q3dtheme.h index c3262b91..44e58e5d 100644 --- a/src/datavisualization/theme/q3dtheme.h +++ b/src/datavisualization/theme/q3dtheme.h @@ -34,7 +34,7 @@ class QT_DATAVISUALIZATION_EXPORT Q3DTheme : public QObject Q_ENUMS(ColorStyle) Q_ENUMS(Theme) Q_PROPERTY(Theme type READ type WRITE setType NOTIFY typeChanged) - Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged) + Q_PROPERTY(QList<QColor> baseColors READ baseColors WRITE setBaseColors NOTIFY baseColorsChanged) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) Q_PROPERTY(QColor windowColor READ windowColor WRITE setWindowColor NOTIFY windowColorChanged) Q_PROPERTY(QColor labelTextColor READ labelTextColor WRITE setLabelTextColor NOTIFY labelTextColorChanged) @@ -43,7 +43,7 @@ class QT_DATAVISUALIZATION_EXPORT Q3DTheme : public QObject Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor NOTIFY singleHighlightColorChanged) Q_PROPERTY(QColor multiHighlightColor READ multiHighlightColor WRITE setMultiHighlightColor NOTIFY multiHighlightColorChanged) Q_PROPERTY(QColor lightColor READ lightColor WRITE setLightColor NOTIFY lightColorChanged) // TODO: Not used yet - Q_PROPERTY(QLinearGradient baseGradient READ baseGradient WRITE setBaseGradient NOTIFY baseGradientChanged) + Q_PROPERTY(QList<QLinearGradient> baseGradients READ baseGradients WRITE setBaseGradients NOTIFY baseGradientsChanged) Q_PROPERTY(QLinearGradient singleHighlightGradient READ singleHighlightGradient WRITE setSingleHighlightGradient NOTIFY singleHighlightGradientChanged) Q_PROPERTY(QLinearGradient multiHighlightGradient READ multiHighlightGradient WRITE setMultiHighlightGradient NOTIFY multiHighlightGradientChanged) Q_PROPERTY(float lightStrength READ lightStrength WRITE setLightStrength NOTIFY lightStrengthChanged) @@ -84,8 +84,8 @@ public: void setType(Theme themeType); Theme type() const; - void setBaseColor(const QColor &color); - QColor baseColor() const; + void setBaseColors(const QList<QColor> &colors); + QList<QColor> baseColors() const; void setBackgroundColor(const QColor &color); QColor backgroundColor() const; @@ -111,8 +111,8 @@ public: void setLightColor(const QColor &color); QColor lightColor() const; - void setBaseGradient(const QLinearGradient &gradient); - QLinearGradient baseGradient() const; + void setBaseGradients(const QList<QLinearGradient> &gradients); + QList<QLinearGradient> baseGradients() const; void setSingleHighlightGradient(const QLinearGradient &gradient); QLinearGradient singleHighlightGradient() const; @@ -149,7 +149,7 @@ public: signals: void typeChanged(Theme themeType); - void baseColorChanged(QColor color); + void baseColorsChanged(QList<QColor> colors); void backgroundColorChanged(QColor color); void windowColorChanged(QColor color); void labelTextColorChanged(QColor color); @@ -158,7 +158,7 @@ signals: void singleHighlightColorChanged(QColor color); void multiHighlightColorChanged(QColor color); void lightColorChanged(QColor color); - void baseGradientChanged(QLinearGradient gradient); + void baseGradientsChanged(QList<QLinearGradient> gradients); void singleHighlightGradientChanged(QLinearGradient gradient); void multiHighlightGradientChanged(QLinearGradient gradient); void lightStrengthChanged(float strength); diff --git a/src/datavisualization/theme/q3dtheme_p.h b/src/datavisualization/theme/q3dtheme_p.h index 1d2032fb..c9f59d99 100644 --- a/src/datavisualization/theme/q3dtheme_p.h +++ b/src/datavisualization/theme/q3dtheme_p.h @@ -105,7 +105,7 @@ public: Q3DThemeDirtyBitField m_dirtyBits; - QColor m_baseColor; + QList<QColor> m_baseColors; QColor m_backgroundColor; QColor m_windowColor; QColor m_textColor; @@ -114,7 +114,7 @@ public: QColor m_singleHighlightColor; QColor m_multiHighlightColor; QColor m_lightColor; - QLinearGradient m_baseGradient; + QList<QLinearGradient> m_baseGradients; QLinearGradient m_singleHighlightGradient; QLinearGradient m_multiHighlightGradient; float m_lightStrength; diff --git a/src/datavisualization/theme/thememanager.cpp b/src/datavisualization/theme/thememanager.cpp index 9ab82441..cefbb897 100644 --- a/src/datavisualization/theme/thememanager.cpp +++ b/src/datavisualization/theme/thememanager.cpp @@ -68,14 +68,14 @@ void ThemeManager::connectThemeSignals() { connect(m_theme.data(), &Q3DTheme::colorStyleChanged, m_controller, &Abstract3DController::handleThemeColorStyleChanged); - connect(m_theme.data(), &Q3DTheme::baseColorChanged, - m_controller, &Abstract3DController::handleThemeBaseColorChanged); + connect(m_theme.data(), &Q3DTheme::baseColorsChanged, + m_controller, &Abstract3DController::handleThemeBaseColorsChanged); connect(m_theme.data(), &Q3DTheme::singleHighlightColorChanged, m_controller, &Abstract3DController::handleThemeSingleHighlightColorChanged); connect(m_theme.data(), &Q3DTheme::multiHighlightColorChanged, m_controller, &Abstract3DController::handleThemeMultiHighlightColorChanged); - connect(m_theme.data(), &Q3DTheme::baseGradientChanged, - m_controller, &Abstract3DController::handleThemeBaseGradientChanged); + connect(m_theme.data(), &Q3DTheme::baseGradientsChanged, + m_controller, &Abstract3DController::handleThemeBaseGradientsChanged); connect(m_theme.data(), &Q3DTheme::singleHighlightGradientChanged, m_controller, &Abstract3DController::handleThemeSingleHighlightGradientChanged); connect(m_theme.data(), &Q3DTheme::multiHighlightGradientChanged, @@ -92,14 +92,18 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) QColor color; QLinearGradient gradient; + // TODO: Add predefined colors & gradients to more than one series + switch (type) { case Q3DTheme::ThemeQt: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0x80c342))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0x80c342))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0xffffff))); setWindowColor(QColor(QRgb(0xffffff))); setTextColor(QColor(QRgb(0x35322f))); @@ -120,7 +124,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0x42 * 0.7); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0x80c342))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0x14 * 0.7); color.setGreen(0xaa * 0.7); color.setBlue(0xff * 0.7); @@ -137,12 +143,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemePrimaryColors: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0xffe400))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0xffe400))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0xffffff))); setWindowColor(QColor(QRgb(0xffffff))); setTextColor(QColor(QRgb(0x000000))); @@ -163,7 +171,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0x00); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0xffe400))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0x27 * 0.7); color.setGreen(0xbe * 0.7); color.setBlue(0xee * 0.7); @@ -180,12 +190,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemeDigia: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0xcccccc))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0xcccccc))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0xffffff))); setWindowColor(QColor(QRgb(0xffffff))); setTextColor(QColor(QRgb(0x000000))); @@ -206,7 +218,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0xcc * 0.7); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0xcccccc))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0xfa * 0.7); color.setGreen(0x00); color.setBlue(0x00); @@ -223,12 +237,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemeStoneMoss: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0xbeb32b))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0xbeb32b))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0x4d4d4f))); setWindowColor(QColor(QRgb(0x4d4d4f))); setTextColor(QColor(QRgb(0xffffff))); @@ -249,7 +265,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0x2b * 0.7); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0xbeb32b))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0xfb* 0.7); color.setGreen(0xf6 * 0.7); color.setBlue(0xd6 * 0.7); @@ -266,12 +284,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemeArmyBlue: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0x495f76))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0x495f76))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0xd5d6d7))); setWindowColor(QColor(QRgb(0xd5d6d7))); setTextColor(QColor(QRgb(0x000000))); @@ -292,7 +312,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0x76 * 0.7); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0x495f76))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0x2a * 0.7); color.setGreen(0xa2 * 0.7); color.setBlue(0xf9 * 0.7); @@ -309,12 +331,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemeRetro: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0x533b23))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0x533b23))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0xe9e2ce))); setWindowColor(QColor(QRgb(0xe9e2ce))); setTextColor(QColor(QRgb(0x000000))); @@ -335,7 +359,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0x23 * 0.7); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0x533b23))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0x8e * 0.7); color.setGreen(0xa3 * 0.7); color.setBlue(0x17 * 0.7); @@ -352,12 +378,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemeEbony: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0xffffff))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0xffffff))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0x000000))); setWindowColor(QColor(QRgb(0x000000))); setTextColor(QColor(QRgb(0xaeadac))); @@ -378,7 +406,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0xff * 0.7); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0xffffff))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0xf5 * 0.7); color.setGreen(0xdc * 0.7); color.setBlue(0x0d * 0.7); @@ -395,12 +425,14 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } case Q3DTheme::ThemeIsabelle: { + QList<QColor> baseColors; + baseColors.append(QColor(QRgb(0xf9d900))); setBackgroundEnabled(true); setGridEnabled(true); setFont(QFont(QStringLiteral("Arial"))); setLabelBackgroundEnabled(true); setLightColor(Qt::white); - setBaseColor(QColor(QRgb(0xf9d900))); + setBaseColors(baseColors); setBackgroundColor(QColor(QRgb(0x000000))); setWindowColor(QColor(QRgb(0x000000))); setTextColor(QColor(QRgb(0xaeadac))); @@ -421,7 +453,9 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) color.setBlue(0x00); gradient.setColorAt(0.0, color); gradient.setColorAt(1.0, QColor(QRgb(0xf9d900))); - setBaseGradient(gradient); + QList<QLinearGradient> baseGradients; + baseGradients.append(gradient); + setBaseGradients(baseGradients); color.setRed(0xff * 0.7); color.setGreen(0xf7 * 0.7); color.setBlue(0xcc * 0.7); @@ -441,10 +475,10 @@ void ThemeManager::useTheme(Q3DTheme::Theme type) } } -void ThemeManager::setBaseColor(const QColor &color) +void ThemeManager::setBaseColors(const QList<QColor> &colors) { if (!m_theme->d_ptr->m_dirtyBits.baseColorDirty) - m_theme->setBaseColor(color); + m_theme->setBaseColors(colors); } void ThemeManager::setBackgroundColor(const QColor &color) @@ -495,10 +529,10 @@ void ThemeManager::setLightColor(const QColor &color) m_theme->setLightColor(color); } -void ThemeManager::setBaseGradient(const QLinearGradient &gradient) +void ThemeManager::setBaseGradients(const QList<QLinearGradient> &gradients) { if (!m_theme->d_ptr->m_dirtyBits.baseGradientDirty) - m_theme->setBaseGradient(gradient); + m_theme->setBaseGradients(gradients); } void ThemeManager::setSingleHighlightGradient(const QLinearGradient &gradient) diff --git a/src/datavisualization/theme/thememanager_p.h b/src/datavisualization/theme/thememanager_p.h index 4a394a4a..a20154df 100644 --- a/src/datavisualization/theme/thememanager_p.h +++ b/src/datavisualization/theme/thememanager_p.h @@ -48,7 +48,7 @@ public: protected: void connectThemeSignals(); void useTheme(Q3DTheme::Theme type); - void setBaseColor(const QColor &color); + void setBaseColors(const QList<QColor> &colors); void setBackgroundColor(const QColor &color); void setWindowColor(const QColor &color); void setTextColor(const QColor &color); @@ -57,7 +57,7 @@ protected: void setSingleHighlightColor(const QColor &color); void setMultiHighlightColor(const QColor &color); void setLightColor(const QColor &color); - void setBaseGradient(const QLinearGradient &gradient); + void setBaseGradients(const QList<QLinearGradient> &gradients); void setSingleHighlightGradient(const QLinearGradient &gradient); void setMultiHighlightGradient(const QLinearGradient &gradient); void setLightStrength(float strength); |