summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-12-02 08:43:02 +0200
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-12-02 09:01:25 +0200
commit94235c2e633845951ce6c947965789bb3f8ee7c4 (patch)
tree60f902b9defe670736dff4bf33d13ef5bfb57804 /src/datavisualization/engine
parent91c9f6791af049b873b7c60a88aa226eaec70c18 (diff)
Theme documented
Task-number: QTRD-2633 Change-Id: Ib274ec236f50145df8fd4c2d83f62d4a9154687a Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine')
-rw-r--r--src/datavisualization/engine/abstract3dcontroller.cpp14
-rw-r--r--src/datavisualization/engine/abstract3dcontroller_p.h18
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp10
-rw-r--r--src/datavisualization/engine/abstract3drenderer_p.h4
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp28
-rw-r--r--src/datavisualization/engine/drawer.cpp4
-rw-r--r--src/datavisualization/engine/q3dbars.cpp10
-rw-r--r--src/datavisualization/engine/q3dbars.h10
-rw-r--r--src/datavisualization/engine/q3dscatter.cpp8
-rw-r--r--src/datavisualization/engine/q3dscatter.h9
-rw-r--r--src/datavisualization/engine/q3dsurface.cpp4
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp12
12 files changed, 61 insertions, 70 deletions
diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp
index b8b2e826..7820cb31 100644
--- a/src/datavisualization/engine/abstract3dcontroller.cpp
+++ b/src/datavisualization/engine/abstract3dcontroller.cpp
@@ -38,14 +38,10 @@ Abstract3DController::Abstract3DController(QRect boundRect, QObject *parent) :
QObject(parent),
m_boundingRect(boundRect.x(), boundRect.y(), boundRect.width(), boundRect.height()),
m_themeManager(new ThemeManager(this)),
- m_font(QFont(QStringLiteral("Arial"))),
m_selectionMode(QDataVis::SelectionItem),
m_shadowQuality(QDataVis::ShadowQualityMedium),
- m_labelBackground(false),
- m_isBackgroundEnabled(true),
- m_isGridEnabled(true),
m_scene(new Q3DScene()),
- m_colorStyle(QDataVis::ColorStyleUniform),
+ m_colorStyle(Q3DTheme::ColorStyleUniform),
m_activeInputHandler(0),
m_axisX(0),
m_axisY(0),
@@ -57,7 +53,7 @@ Abstract3DController::Abstract3DController(QRect boundRect, QObject *parent) :
m_renderPending(false)
{
// Set initial theme
- setTheme(new Q3DTheme(QDataVis::ThemeQt));
+ setTheme(new Q3DTheme(Q3DTheme::ThemeQt));
// Populate the scene
m_scene->activeLight()->setPosition(defaultLightPos);
@@ -660,11 +656,11 @@ void Abstract3DController::setZoomLevel(int zoomLevel)
emitNeedRender();
}
-void Abstract3DController::setColorStyle(QDataVis::ColorStyle style)
+void Abstract3DController::setColorStyle(Q3DTheme::ColorStyle style)
{
if (style != m_colorStyle || m_changeTracker.themeChanged) {
Q3DTheme *theme = m_themeManager->theme();
- if (style == QDataVis::ColorStyleUniform) {
+ if (style == Q3DTheme::ColorStyleUniform) {
setBaseColor(theme->baseColor());
setSingleHighlightColor(theme->singleHighlightColor());
setMultiHighlightColor(theme->multiHighlightColor());
@@ -682,7 +678,7 @@ void Abstract3DController::setColorStyle(QDataVis::ColorStyle style)
}
}
-QDataVis::ColorStyle Abstract3DController::colorStyle() const
+Q3DTheme::ColorStyle Abstract3DController::colorStyle() const
{
return m_colorStyle;
}
diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h
index 27cfb9a1..850bd3e5 100644
--- a/src/datavisualization/engine/abstract3dcontroller_p.h
+++ b/src/datavisualization/engine/abstract3dcontroller_p.h
@@ -53,14 +53,11 @@ struct Abstract3DChangeBitField {
bool positionChanged : 1;
bool zoomLevelChanged : 1;
bool themeChanged : 1;
- bool fontChanged : 1;
- bool labelBackgroundEnabledChanged : 1;
bool boundingRectChanged : 1;
bool sizeChanged : 1;
bool shadowQualityChanged : 1;
bool selectionModeChanged : 1;
bool objFileChanged : 1;
- bool gridEnabledChanged : 1;
bool axisXTypeChanged : 1;
bool axisYTypeChanged : 1;
bool axisZTypeChanged : 1;
@@ -96,14 +93,11 @@ struct Abstract3DChangeBitField {
positionChanged(true),
zoomLevelChanged(true),
themeChanged(true),
- fontChanged(true),
- labelBackgroundEnabledChanged(true),
boundingRectChanged(true),
sizeChanged(true),
shadowQualityChanged(true),
selectionModeChanged(true),
objFileChanged(true),
- gridEnabledChanged(true),
axisXTypeChanged(true),
axisYTypeChanged(true),
axisZTypeChanged(true),
@@ -164,14 +158,10 @@ private:
GLfloat m_horizontalRotation;
GLfloat m_verticalRotation;
ThemeManager *m_themeManager;
- QFont m_font;
QDataVis::SelectionFlags m_selectionMode;
QDataVis::ShadowQuality m_shadowQuality;
- bool m_labelBackground;
- bool m_isBackgroundEnabled;
- bool m_isGridEnabled;
Q3DScene *m_scene;
- QDataVis::ColorStyle m_colorStyle;
+ Q3DTheme::ColorStyle m_colorStyle;
QColor m_objectColor;
QLinearGradient m_objectGradient;
QColor m_singleHighlightColor;
@@ -256,8 +246,8 @@ public:
// Properties from color api
// TODO: Rethink these after color api has been moveed to series (QTRD-2200/2557)
- virtual void setColorStyle(QDataVis::ColorStyle style);
- virtual QDataVis::ColorStyle colorStyle() const;
+ virtual void setColorStyle(Q3DTheme::ColorStyle style);
+ virtual Q3DTheme::ColorStyle colorStyle() const;
virtual void setBaseColor(const QColor &color);
virtual QColor baseColor() const;
virtual void setBaseGradient(const QLinearGradient &gradient);
@@ -325,7 +315,7 @@ signals:
void themeChanged(Q3DTheme *theme);
void selectionModeChanged(QDataVis::SelectionFlags mode);
void needRender();
- void colorStyleChanged(QDataVis::ColorStyle style);
+ void colorStyleChanged(Q3DTheme::ColorStyle style);
void objectColorChanged(QColor color);
void objectGradientChanged(QLinearGradient gradient);
void singleHighlightColorChanged(QColor color);
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
index 7e17baff..06f13b5d 100644
--- a/src/datavisualization/engine/abstract3drenderer.cpp
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -40,7 +40,7 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller)
m_cachedShadowQuality(QDataVis::ShadowQualityMedium),
m_autoScaleAdjustment(1.0f),
m_cachedSelectionMode(QDataVis::SelectionNone),
- m_cachedColorStyle(QDataVis::ColorStyleUniform),
+ m_cachedColorStyle(Q3DTheme::ColorStyleUniform),
m_objectGradientTexture(0),
m_singleHighlightGradientTexture(0),
m_multiHighlightGradientTexture(0),
@@ -207,7 +207,7 @@ void Abstract3DRenderer::reInitShaders()
{
#if !defined(QT_OPENGL_ES_2)
if (m_cachedShadowQuality > QDataVis::ShadowQualityNone) {
- if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle != Q3DTheme::ColorStyleUniform) {
initShaders(QStringLiteral(":/shaders/vertexShadow"),
QStringLiteral(":/shaders/fragmentShadowNoTexColorOnY"));
} else {
@@ -217,7 +217,7 @@ void Abstract3DRenderer::reInitShaders()
initBackgroundShaders(QStringLiteral(":/shaders/vertexShadow"),
QStringLiteral(":/shaders/fragmentShadowNoTex"));
} else {
- if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle != Q3DTheme::ColorStyleUniform) {
initShaders(QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentColorOnY"));
} else {
@@ -228,7 +228,7 @@ void Abstract3DRenderer::reInitShaders()
QStringLiteral(":/shaders/fragment"));
}
#else
- if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle != Q3DTheme::ColorStyleUniform) {
initShaders(QStringLiteral(":/shaders/vertex"),
QStringLiteral(":/shaders/fragmentColorOnYES2"));
} else {
@@ -317,7 +317,7 @@ void Abstract3DRenderer::updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation
axisCacheForOrientation(orientation).setLabelFormat(format);
}
-void Abstract3DRenderer::updateColorStyle(QDataVis::ColorStyle style)
+void Abstract3DRenderer::updateColorStyle(Q3DTheme::ColorStyle style)
{
bool changed = (m_cachedColorStyle != style);
diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h
index fe213b33..98e3face 100644
--- a/src/datavisualization/engine/abstract3drenderer_p.h
+++ b/src/datavisualization/engine/abstract3drenderer_p.h
@@ -68,7 +68,7 @@ protected:
QDataVis::SelectionFlags m_cachedSelectionMode;
- QDataVis::ColorStyle m_cachedColorStyle;
+ Q3DTheme::ColorStyle m_cachedColorStyle;
QColor m_cachedObjectColor;
QLinearGradient m_cachedObjectGradient;
GLuint m_objectGradientTexture;
@@ -131,7 +131,7 @@ public:
virtual void updateAxisSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count);
virtual void updateAxisSubSegmentCount(Q3DAbstractAxis::AxisOrientation orientation, int count);
virtual void updateAxisLabelFormat(Q3DAbstractAxis::AxisOrientation orientation, const QString &format);
- virtual void updateColorStyle(QDataVis::ColorStyle style);
+ virtual void updateColorStyle(Q3DTheme::ColorStyle style);
virtual void updateObjectColor(const QColor &color);
virtual void updateObjectGradient(const QLinearGradient &gradient);
virtual void updateSingleHighlightColor(const QColor &color);
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index addad904..e665eca1 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -471,9 +471,9 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel,
m_barShader->setUniformValue(m_barShader->lightS(), 0.5f);
m_barShader->setUniformValue(m_barShader->ambientS(),
m_cachedTheme->ambientLightStrength() * 2.0f);
- if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle != Q3DTheme::ColorStyleUniform) {
m_barShader->setUniformValue(m_barShader->gradientMin(), 0.0f);
- if (m_cachedColorStyle == QDataVis::ColorStyleObjectGradient)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleObjectGradient)
m_barShader->setUniformValue(m_barShader->gradientHeight(), 0.5f);
gradientTexture = m_objectGradientTexture;
@@ -516,12 +516,12 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel,
// TODO: Get color from correct series
if (itemMode && m_visualSelectedBarPos.x() == item->position().x()
&& m_visualSelectedBarPos.y() == item->position().y()) {
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform)
barColor = barHighlightColor;
else
gradientTexture = m_singleHighlightGradientTexture;
} else {
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform)
barColor = rowHighlightColor;
else
gradientTexture = m_multiHighlightGradientTexture;
@@ -533,9 +533,9 @@ void Bars3DRenderer::drawSlicedScene(const LabelItem &xLabel,
m_barShader->setUniformValue(m_barShader->nModel(),
itModelMatrix.inverted().transposed());
m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix);
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform) {
m_barShader->setUniformValue(m_barShader->color(), barColor);
- } else if (m_cachedColorStyle == QDataVis::ColorStyleRangeGradient) {
+ } else if (m_cachedColorStyle == Q3DTheme::ColorStyleRangeGradient) {
m_barShader->setUniformValue(m_barShader->gradientHeight(),
(qAbs(item->height()) / m_gradientFraction));
}
@@ -990,9 +990,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_barShader->setUniformValue(m_barShader->view(), viewMatrix);
m_barShader->setUniformValue(m_barShader->ambientS(),
m_cachedTheme->ambientLightStrength());
- if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle != Q3DTheme::ColorStyleUniform) {
m_barShader->setUniformValue(m_barShader->gradientMin(), 0.0f);
- if (m_cachedColorStyle == QDataVis::ColorStyleObjectGradient)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleObjectGradient)
m_barShader->setUniformValue(m_barShader->gradientHeight(), 0.5f);
gradientTexture = m_objectGradientTexture;
@@ -1066,7 +1066,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
MVPMatrix = projectionViewMatrix * modelMatrix;
#endif
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform)
barColor = baseColor;
else
gradientTexture = m_objectGradientTexture;
@@ -1081,7 +1081,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
switch (selectionType) {
case Bars3DController::SelectionItem: {
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform)
barColor = barHighlightColor;
else
gradientTexture = m_singleHighlightGradientTexture;
@@ -1113,7 +1113,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
case Bars3DController::SelectionRow: {
// Current bar is on the same row as the selected bar
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform)
barColor = rowHighlightColor;
else
gradientTexture = m_multiHighlightGradientTexture;
@@ -1134,7 +1134,7 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
}
case Bars3DController::SelectionColumn: {
// Current bar is on the same column as the selected bar
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform)
barColor = rowHighlightColor;
else
gradientTexture = m_multiHighlightGradientTexture;
@@ -1174,9 +1174,9 @@ void Bars3DRenderer::drawScene(GLuint defaultFboHandle)
m_barShader->setUniformValue(m_barShader->nModel(),
itModelMatrix.transposed().inverted());
m_barShader->setUniformValue(m_barShader->MVP(), MVPMatrix);
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform) {
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform) {
m_barShader->setUniformValue(m_barShader->color(), barColor);
- } else if (m_cachedColorStyle == QDataVis::ColorStyleRangeGradient) {
+ } else if (m_cachedColorStyle == Q3DTheme::ColorStyleRangeGradient) {
m_barShader->setUniformValue(m_barShader->gradientHeight(),
qAbs(item.height()) / m_gradientFraction);
}
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index 87f64e4f..f88b1f49 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -364,8 +364,8 @@ void Drawer::generateLabelItem(LabelItem &item, const QString &text, int widestL
// Print label into a QImage using QPainter
QImage label = Utils::printTextToImage(m_font,
text,
- m_theme->textBackgroundColor(),
- m_theme->textColor(),
+ m_theme->labelBackgroundColor(),
+ m_theme->labelTextColor(),
m_labelBackground,
m_theme->isLabelBorderEnabled(),
widestLabel);
diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp
index 095c5d8d..1d297f1b 100644
--- a/src/datavisualization/engine/q3dbars.cpp
+++ b/src/datavisualization/engine/q3dbars.cpp
@@ -300,9 +300,9 @@ bool Q3DBars::isBarSpacingRelative()
/*!
* \property Q3DBars::theme
*
- * A user-defined theme.
- *
- * TODO: Add docs.
+ * A \a theme to be used for the graph. Ownership of the \a theme is transferred. Previous theme
+ * is deleted when a new one is set. Properties of the \a theme can be modified even after setting
+ * it, and the modifications take effect immediately.
*/
void Q3DBars::setTheme(Q3DTheme *theme)
{
@@ -368,12 +368,12 @@ QDataVis::ShadowQuality Q3DBars::shadowQuality() const
*
* \sa barColor, barGradient
*/
-void Q3DBars::setColorStyle(QDataVis::ColorStyle style)
+void Q3DBars::setColorStyle(Q3DTheme::ColorStyle style)
{
d_ptr->m_shared->setColorStyle(style);
}
-QDataVis::ColorStyle Q3DBars::colorStyle() const
+Q3DTheme::ColorStyle Q3DBars::colorStyle() const
{
return d_ptr->m_shared->colorStyle();
}
diff --git a/src/datavisualization/engine/q3dbars.h b/src/datavisualization/engine/q3dbars.h
index 37243a0d..cdb0d9a7 100644
--- a/src/datavisualization/engine/q3dbars.h
+++ b/src/datavisualization/engine/q3dbars.h
@@ -21,6 +21,7 @@
#include <QtDataVisualization/qdatavisualizationenums.h>
#include <QtDataVisualization/q3dwindow.h>
+#include <QtDataVisualization/q3dtheme.h>
#include <QFont>
#include <QLinearGradient>
@@ -32,7 +33,6 @@ class Q3DCategoryAxis;
class Q3DValueAxis;
class Q3DScene;
class QBar3DSeries;
-class Q3DTheme;
class QT_DATAVISUALIZATION_EXPORT Q3DBars : public Q3DWindow
{
@@ -44,7 +44,7 @@ class QT_DATAVISUALIZATION_EXPORT Q3DBars : public Q3DWindow
Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged)
Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged)
Q_PROPERTY(Q3DScene* scene READ scene)
- Q_PROPERTY(QtDataVisualization::QDataVis::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged)
+ Q_PROPERTY(QtDataVisualization::Q3DTheme::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged)
Q_PROPERTY(QColor barColor READ barColor WRITE setBarColor NOTIFY barColorChanged)
Q_PROPERTY(QLinearGradient barGradient READ barGradient WRITE setBarGradient NOTIFY barGradientChanged)
Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor NOTIFY singleHighlightColorChanged)
@@ -84,8 +84,8 @@ public:
QDataVis::ShadowQuality shadowQuality() const;
// TODO: Move to dataset object once that is done QTRD-2121
- void setColorStyle(QDataVis::ColorStyle style);
- QDataVis::ColorStyle colorStyle() const;
+ void setColorStyle(Q3DTheme::ColorStyle style);
+ Q3DTheme::ColorStyle colorStyle() const;
void setBarColor(const QColor &color);
QColor barColor() const;
void setBarGradient(const QLinearGradient &gradient);
@@ -116,7 +116,7 @@ signals:
void barSpacingChanged(QSizeF spacing);
void barSpacingRelativeChanged(bool relative);
void themeChanged(Q3DTheme *theme);
- void colorStyleChanged(QDataVis::ColorStyle style);
+ void colorStyleChanged(Q3DTheme::ColorStyle style);
void barColorChanged(QColor color);
void barGradientChanged(QLinearGradient gradient);
void singleHighlightColorChanged(QColor color);
diff --git a/src/datavisualization/engine/q3dscatter.cpp b/src/datavisualization/engine/q3dscatter.cpp
index a71bdb18..e65aef0f 100644
--- a/src/datavisualization/engine/q3dscatter.cpp
+++ b/src/datavisualization/engine/q3dscatter.cpp
@@ -221,7 +221,9 @@ void Q3DScatter::setHeight(const int height)
/*!
* \property Q3DScatter::theme
*
- * TODO: Add docs
+ * A \a theme to be used for the graph. Ownership of the \a theme is transferred. Previous theme
+ * is deleted when a new one is set. Properties of the \a theme can be modified even after setting
+ * it, and the modifications take effect immediately.
*/
void Q3DScatter::setTheme(Q3DTheme *theme)
{
@@ -289,12 +291,12 @@ QDataVis::ShadowQuality Q3DScatter::shadowQuality() const
*
* \sa itemColor, itemGradient
*/
-void Q3DScatter::setColorStyle(QDataVis::ColorStyle style)
+void Q3DScatter::setColorStyle(Q3DTheme::ColorStyle style)
{
d_ptr->m_shared->setColorStyle(style);
}
-QDataVis::ColorStyle Q3DScatter::colorStyle() const
+Q3DTheme::ColorStyle Q3DScatter::colorStyle() const
{
return d_ptr->m_shared->colorStyle();
}
diff --git a/src/datavisualization/engine/q3dscatter.h b/src/datavisualization/engine/q3dscatter.h
index 917b31bc..96ccf69b 100644
--- a/src/datavisualization/engine/q3dscatter.h
+++ b/src/datavisualization/engine/q3dscatter.h
@@ -22,6 +22,7 @@
#include <QtDataVisualization/qdatavisualizationenums.h>
#include <QtDataVisualization/q3dwindow.h>
#include <QtDataVisualization/q3dscene.h>
+#include <QtDataVisualization/q3dtheme.h>
#include <QFont>
#include <QLinearGradient>
@@ -41,7 +42,7 @@ class QT_DATAVISUALIZATION_EXPORT Q3DScatter : public Q3DWindow
Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged)
Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged)
Q_PROPERTY(Q3DScene* scene READ scene)
- Q_PROPERTY(QtDataVisualization::QDataVis::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged)
+ Q_PROPERTY(QtDataVisualization::Q3DTheme::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged)
Q_PROPERTY(QColor itemColor READ itemColor WRITE setItemColor NOTIFY itemColorChanged)
Q_PROPERTY(QLinearGradient itemGradient READ itemGradient WRITE setItemGradient NOTIFY itemGradientChanged)
Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor NOTIFY singleHighlightColorChanged)
@@ -72,8 +73,8 @@ public:
QDataVis::ShadowQuality shadowQuality() const;
// TODO: Move to dataset object once that is done QTRD-2121
- void setColorStyle(QDataVis::ColorStyle style);
- QDataVis::ColorStyle colorStyle() const;
+ void setColorStyle(Q3DTheme::ColorStyle style);
+ Q3DTheme::ColorStyle colorStyle() const;
void setItemColor(const QColor &color);
QColor itemColor() const;
void setItemGradient(const QLinearGradient &gradient);
@@ -101,7 +102,7 @@ signals:
void selectionModeChanged(QDataVis::SelectionFlags mode);
void shadowQualityChanged(QDataVis::ShadowQuality quality);
void themeChanged(Q3DTheme* theme);
- void colorStyleChanged(QDataVis::ColorStyle style);
+ void colorStyleChanged(Q3DTheme::ColorStyle style);
void itemColorChanged(QColor color);
void itemGradientChanged(QLinearGradient gradient);
void singleHighlightColorChanged(QColor color);
diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp
index 22b671e1..b678ba16 100644
--- a/src/datavisualization/engine/q3dsurface.cpp
+++ b/src/datavisualization/engine/q3dsurface.cpp
@@ -209,7 +209,9 @@ void Q3DSurface::resizeEvent(QResizeEvent *event)
/*!
* \property Q3DSurface::theme
*
- * TODO: Add docs
+ * A \a theme to be used for the graph. Ownership of the \a theme is transferred. Previous theme
+ * is deleted when a new one is set. Properties of the \a theme can be modified even after setting
+ * it, and the modifications take effect immediately.
*/
void Q3DSurface::setTheme(Q3DTheme *theme)
{
diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp
index 27262c4c..627fc88a 100644
--- a/src/datavisualization/engine/scatter3drenderer.cpp
+++ b/src/datavisualization/engine/scatter3drenderer.cpp
@@ -561,8 +561,8 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
dotShader->setUniformValue(dotShader->lightP(), lightPos);
dotShader->setUniformValue(dotShader->view(), viewMatrix);
dotShader->setUniformValue(dotShader->ambientS(), m_cachedTheme->ambientLightStrength());
- if (m_cachedColorStyle != QDataVis::ColorStyleUniform) {
- if (m_cachedColorStyle == QDataVis::ColorStyleObjectGradient) {
+ if (m_cachedColorStyle != Q3DTheme::ColorStyleUniform) {
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleObjectGradient) {
dotShader->setUniformValue(dotShader->gradientMin(), 0.0f);
dotShader->setUniformValue(dotShader->gradientHeight(), 0.5f);
} else {
@@ -624,14 +624,14 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
MVPMatrix = projectionViewMatrix * modelMatrix;
#endif
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform || drawingPoints)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform || drawingPoints)
dotColor = baseColor;
else
gradientTexture = m_objectGradientTexture;
GLfloat lightStrength = m_cachedTheme->lightStrength();
if (m_cachedSelectionMode > QDataVis::SelectionNone && (m_selectedItemTotalIndex == dotNo)) {
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform || drawingPoints)
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform || drawingPoints)
dotColor = Utils::vectorFromColor(m_cachedSingleHighlightColor);
else
gradientTexture = m_singleHighlightGradientTexture;
@@ -648,9 +648,9 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
itModelMatrix.inverted().transposed());
}
dotShader->setUniformValue(dotShader->MVP(), MVPMatrix);
- if (m_cachedColorStyle == QDataVis::ColorStyleUniform || drawingPoints) {
+ if (m_cachedColorStyle == Q3DTheme::ColorStyleUniform || drawingPoints) {
dotShader->setUniformValue(dotShader->color(), dotColor);
- } else if (m_cachedColorStyle == QDataVis::ColorStyleRangeGradient) {
+ } else if (m_cachedColorStyle == Q3DTheme::ColorStyleRangeGradient) {
dotShader->setUniformValue(dotShader->gradientMin(),
(item.position().y() + 1.0f) / 2.0f);
}