From 5fde532408da5b6b3ddef13aff5e07f32015e7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Thu, 28 Nov 2013 06:40:59 +0200 Subject: Visual properties moved to theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTRD-2632 Change-Id: I91eaa8fa26e232de24fe89ef0c8a2fc53f31fb8c Reviewed-by: Tomi Korpipää --- .../engine/abstract3dcontroller.cpp | 65 +++++------ .../engine/abstract3dcontroller_p.h | 51 +++------ .../engine/abstract3drenderer.cpp | 13 ++- .../engine/abstract3drenderer_p.h | 4 +- src/datavisualization/engine/bars3drenderer.cpp | 3 + src/datavisualization/engine/drawer.cpp | 10 +- src/datavisualization/engine/drawer_p.h | 6 +- src/datavisualization/engine/q3dbars.cpp | 77 +------------ src/datavisualization/engine/q3dbars.h | 20 ---- src/datavisualization/engine/q3dscatter.cpp | 77 +------------ src/datavisualization/engine/q3dscatter.h | 20 ---- src/datavisualization/engine/q3dsurface.cpp | 69 ------------ src/datavisualization/engine/q3dsurface.h | 20 ---- src/datavisualization/engine/selectionpointer.cpp | 2 +- src/datavisualization/engine/selectionpointer_p.h | 2 +- src/datavisualization/engine/surface3drenderer.cpp | 11 +- src/datavisualization/engine/surface3drenderer_p.h | 2 +- .../global/qdatavisualizationenums.h | 7 -- src/datavisualization/theme/q3dtheme.cpp | 99 +++++++++++++++++ src/datavisualization/theme/q3dtheme.h | 24 +++- src/datavisualization/theme/q3dtheme_p.h | 21 +++- src/datavisualization/theme/thememanager.cpp | 121 +++++++++++++++++---- src/datavisualization/theme/thememanager_p.h | 4 + src/datavisualization/utils/utils.cpp | 34 +----- src/datavisualization/utils/utils_p.h | 2 +- src/datavisualizationqml2/abstractdeclarative.cpp | 48 -------- src/datavisualizationqml2/abstractdeclarative_p.h | 20 ---- src/datavisualizationqml2/declarativebars.cpp | 2 +- src/datavisualizationqml2/declarativescatter.cpp | 2 +- 29 files changed, 330 insertions(+), 506 deletions(-) (limited to 'src') diff --git a/src/datavisualization/engine/abstract3dcontroller.cpp b/src/datavisualization/engine/abstract3dcontroller.cpp index b84bb2f7..d06a2609 100644 --- a/src/datavisualization/engine/abstract3dcontroller.cpp +++ b/src/datavisualization/engine/abstract3dcontroller.cpp @@ -41,7 +41,7 @@ Abstract3DController::Abstract3DController(QRect boundRect, QObject *parent) : m_font(QFont(QStringLiteral("Arial"))), m_selectionMode(QDataVis::SelectionItem), m_shadowQuality(QDataVis::ShadowQualityMedium), - m_labelStyle(QDataVis::LabelStyleTransparent), + m_labelBackground(false), m_isBackgroundEnabled(true), m_isGridEnabled(true), m_scene(new Q3DScene()), @@ -147,6 +147,7 @@ void Abstract3DController::synchDataToRenderer() m_changeTracker.themeChanged = false; } + // TODO: Move to a sync function to clean this up a bit (make a separate task) if (m_changeTracker.colorStyleChanged) { m_renderer->updateColorStyle(m_colorStyle); m_changeTracker.colorStyleChanged = false; @@ -187,9 +188,19 @@ void Abstract3DController::synchDataToRenderer() m_changeTracker.fontChanged = false; } - if (m_changeTracker.labelStyleChanged) { - m_renderer->updateLabelStyle(m_labelStyle); - m_changeTracker.labelStyleChanged = false; + if (m_changeTracker.labelBackgroundEnabledChanged) { + m_renderer->updateLabelBackgroundEnabled(m_labelBackground); + m_changeTracker.labelBackgroundEnabledChanged = false; + } + + if (m_changeTracker.gridEnabledChanged) { + m_renderer->updateGridEnabled(m_isGridEnabled); + m_changeTracker.gridEnabledChanged = false; + } + + if (m_changeTracker.backgroundEnabledChanged) { + m_renderer->updateBackgroundEnabled(m_isBackgroundEnabled); + m_changeTracker.backgroundEnabledChanged = false; } if (m_changeTracker.shadowQualityChanged) { @@ -207,16 +218,6 @@ void Abstract3DController::synchDataToRenderer() m_changeTracker.objFileChanged = false; } - if (m_changeTracker.gridEnabledChanged) { - m_renderer->updateGridEnabled(m_isGridEnabled); - m_changeTracker.gridEnabledChanged = false; - } - - if (m_changeTracker.backgroundEnabledChanged) { - m_renderer->updateBackgroundEnabled(m_isBackgroundEnabled); - m_changeTracker.backgroundEnabledChanged = false; - } - if (m_changeTracker.axisXTypeChanged) { m_renderer->updateAxisType(Q3DAbstractAxis::AxisOrientationX, m_axisX->type()); m_changeTracker.axisXTypeChanged = false; @@ -687,11 +688,11 @@ void Abstract3DController::setColorStyle(QDataVis::ColorStyle style) if (style != m_colorStyle || m_changeTracker.themeChanged) { Q3DTheme *theme = m_themeManager->theme(); if (style == QDataVis::ColorStyleUniform) { - setObjectColor(theme->baseColor()); + setBaseColor(theme->baseColor()); setSingleHighlightColor(theme->singleHighlightColor()); setMultiHighlightColor(theme->multiHighlightColor()); } else { - setObjectGradient(theme->baseGradient()); + setBaseGradient(theme->baseGradient()); setSingleHighlightGradient(theme->singleHighlightGradient()); setMultiHighlightGradient(theme->multiHighlightGradient()); } @@ -709,7 +710,7 @@ QDataVis::ColorStyle Abstract3DController::colorStyle() const return m_colorStyle; } -void Abstract3DController::setObjectColor(const QColor &color) +void Abstract3DController::setBaseColor(const QColor &color) { if (color != m_objectColor) { m_objectColor = color; @@ -719,12 +720,12 @@ void Abstract3DController::setObjectColor(const QColor &color) } } -QColor Abstract3DController::objectColor() const +QColor Abstract3DController::baseColor() const { return m_objectColor; } -void Abstract3DController::setObjectGradient(const QLinearGradient &gradient) +void Abstract3DController::setBaseGradient(const QLinearGradient &gradient) { if (gradient != m_objectGradient) { m_objectGradient = gradient; @@ -734,7 +735,7 @@ void Abstract3DController::setObjectGradient(const QLinearGradient &gradient) } } -QLinearGradient Abstract3DController::objectGradient() const +QLinearGradient Abstract3DController::baseGradient() const { return m_objectGradient; } @@ -803,10 +804,14 @@ void Abstract3DController::setTheme(Q3DTheme *theme) { if (theme != m_themeManager->theme()) { m_themeManager->setTheme(theme); - QDataVis::ColorStyle colorStyle = theme->colorStyle(); m_changeTracker.themeChanged = true; // TODO: set all colors/styles here (QTRD-2538) - setColorStyle(colorStyle); + setColorStyle(theme->colorStyle()); + // Set all other theme properties + setBackgroundEnabled(theme->isBackgroundEnabled()); + setFont(theme->font()); + setGridEnabled(theme->isGridEnabled()); + setLabelBackgroundEnabled(theme->isLabelBackgroundEnabled()); emit themeChanged(theme); } } @@ -821,7 +826,6 @@ void Abstract3DController::setFont(const QFont &font) if (font != m_font) { m_font = font; m_changeTracker.fontChanged = true; - emit fontChanged(font); emitNeedRender(); } } @@ -861,19 +865,18 @@ QDataVis::ShadowQuality Abstract3DController::shadowQuality() const return m_shadowQuality; } -void Abstract3DController::setLabelStyle(QDataVis::LabelStyle style) +void Abstract3DController::setLabelBackgroundEnabled(bool enable) { - if (style != m_labelStyle) { - m_labelStyle = style; - m_changeTracker.labelStyleChanged = true; - emit labelStyleChanged(style); + if (enable != m_labelBackground) { + m_labelBackground = enable; + m_changeTracker.labelBackgroundEnabledChanged = true; emitNeedRender(); } } -QDataVis::LabelStyle Abstract3DController::labelStyle() const +bool Abstract3DController::isLabelBackgroundEnabled() const { - return m_labelStyle; + return m_labelBackground; } void Abstract3DController::setBackgroundEnabled(bool enable) @@ -881,7 +884,6 @@ void Abstract3DController::setBackgroundEnabled(bool enable) if (enable != m_isBackgroundEnabled) { m_isBackgroundEnabled = enable; m_changeTracker.backgroundEnabledChanged = true; - emit backgroundVisibleChanged(enable); emitNeedRender(); } } @@ -896,7 +898,6 @@ void Abstract3DController::setGridEnabled(bool enable) if (enable != m_isGridEnabled) { m_isGridEnabled = enable; m_changeTracker.gridEnabledChanged = true; - emit gridVisibleChanged(enable); emitNeedRender(); } } diff --git a/src/datavisualization/engine/abstract3dcontroller_p.h b/src/datavisualization/engine/abstract3dcontroller_p.h index 52a6728c..0180623c 100644 --- a/src/datavisualization/engine/abstract3dcontroller_p.h +++ b/src/datavisualization/engine/abstract3dcontroller_p.h @@ -54,7 +54,7 @@ struct Abstract3DChangeBitField { bool zoomLevelChanged : 1; bool themeChanged : 1; bool fontChanged : 1; - bool labelStyleChanged : 1; + bool labelBackgroundEnabledChanged : 1; bool boundingRectChanged : 1; bool sizeChanged : 1; bool shadowQualityChanged : 1; @@ -98,7 +98,7 @@ struct Abstract3DChangeBitField { zoomLevelChanged(true), themeChanged(true), fontChanged(true), - labelStyleChanged(true), + labelBackgroundEnabledChanged(true), boundingRectChanged(true), sizeChanged(true), shadowQualityChanged(true), @@ -169,7 +169,7 @@ private: QFont m_font; QDataVis::SelectionFlags m_selectionMode; QDataVis::ShadowQuality m_shadowQuality; - QDataVis::LabelStyle m_labelStyle; + bool m_labelBackground; bool m_isBackgroundEnabled; bool m_isGridEnabled; QString m_objFile; @@ -253,12 +253,16 @@ public: virtual int zoomLevel(); virtual void setZoomLevel(int zoomLevel); + virtual void setTheme(Q3DTheme *theme); + virtual Q3DTheme *theme() const; + + // Properties from theme virtual void setColorStyle(QDataVis::ColorStyle style); virtual QDataVis::ColorStyle colorStyle() const; - virtual void setObjectColor(const QColor &color); - virtual QColor objectColor() const; - virtual void setObjectGradient(const QLinearGradient &gradient); - virtual QLinearGradient objectGradient() const; + virtual void setBaseColor(const QColor &color); + virtual QColor baseColor() const; + virtual void setBaseGradient(const QLinearGradient &gradient); + virtual QLinearGradient baseGradient() const; virtual void setSingleHighlightColor(const QColor &color); virtual QColor singleHighlightColor() const; virtual void setSingleHighlightGradient(const QLinearGradient &gradient); @@ -267,41 +271,24 @@ public: virtual QColor multiHighlightColor() const; virtual void setMultiHighlightGradient(const QLinearGradient &gradient); virtual QLinearGradient multiHighlightGradient() const; - - // Set theme (bar colors, shaders, window color, background colors, light intensity and text - // colors are affected) - virtual void setTheme(Q3DTheme *theme); - virtual Q3DTheme *theme() const; - - // Set font virtual void setFont(const QFont &font); virtual QFont font() const; + virtual void setLabelBackgroundEnabled(bool enable); + virtual bool isLabelBackgroundEnabled() const; + virtual void setBackgroundEnabled(bool enable); + virtual bool backgroundEnabled() const; + virtual void setGridEnabled(bool enable); + virtual bool gridEnabled() const; - // Selection mode virtual void setSelectionMode(QDataVis::SelectionFlags mode); virtual QDataVis::SelectionFlags selectionMode() const; - // Adjust shadow quality virtual void setShadowQuality(QDataVis::ShadowQuality quality); virtual QDataVis::ShadowQuality shadowQuality() const; - // Label style adjustment - virtual void setLabelStyle(QDataVis::LabelStyle style); - virtual QDataVis::LabelStyle labelStyle() const; - - // Enable or disable background mesh - virtual void setBackgroundEnabled(bool enable); - virtual bool backgroundEnabled() const; - - // Enable or disable background grid - virtual void setGridEnabled(bool enable); - virtual bool gridEnabled() const; - - // Enable or disable slicing mode bool isSlicingActive() const; void setSlicingActive(bool isSlicing); - // override bar type with own mesh virtual void setMeshFileName(const QString &fileName); virtual QString meshFileName() const; @@ -346,11 +333,7 @@ signals: void shadowQualityChanged(QDataVis::ShadowQuality quality); void activeInputHandlerChanged(QAbstract3DInputHandler *inputHandler); void themeChanged(Q3DTheme *theme); - void fontChanged(QFont font); void selectionModeChanged(QDataVis::SelectionFlags mode); - void labelStyleChanged(QDataVis::LabelStyle style); - void backgroundVisibleChanged(bool visible); - void gridVisibleChanged(bool visible); void meshFileNameChanged(QString filename); void needRender(); void colorStyleChanged(QDataVis::ColorStyle style); diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index ed62dbe4..118f7b13 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -34,9 +34,9 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller) m_hasNegativeValues(false), m_cachedTheme(), m_cachedFont(QFont(QStringLiteral("Arial"))), - m_cachedLabelStyle(QDataVis::LabelStyleFromTheme), - m_drawer(new Drawer(m_cachedTheme, m_cachedFont, m_cachedLabelStyle)), - m_cachedBoundingRect(QRect(0,0,0,0)), + m_cachedLabelBackground(false), + m_drawer(new Drawer(m_cachedTheme, m_cachedFont, m_cachedLabelBackground)), + m_cachedBoundingRect(QRect(0, 0, 0, 0)), m_cachedShadowQuality(QDataVis::ShadowQualityMedium), m_autoScaleAdjustment(1.0f), m_cachedSelectionMode(QDataVis::SelectionNone), @@ -258,10 +258,11 @@ void Abstract3DRenderer::updateFont(const QFont &font) m_drawer->setFont(font); } -void Abstract3DRenderer::updateLabelStyle(QDataVis::LabelStyle style) +void Abstract3DRenderer::updateLabelBackgroundEnabled(bool enabled) { - m_cachedLabelStyle = style; - m_drawer->setStyle(style); + qDebug() << __FUNCTION__ << enabled; + m_cachedLabelBackground = enabled; + m_drawer->setLabelBackground(enabled); } void Abstract3DRenderer::updateMeshFileName(const QString &objFileName) diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h index 300d75ca..ea659524 100644 --- a/src/datavisualization/engine/abstract3drenderer_p.h +++ b/src/datavisualization/engine/abstract3drenderer_p.h @@ -62,7 +62,7 @@ protected: bool m_hasNegativeValues; Q3DTheme *m_cachedTheme; QFont m_cachedFont; - QDataVis::LabelStyle m_cachedLabelStyle; + bool m_cachedLabelBackground; Drawer *m_drawer; QRect m_cachedBoundingRect; QDataVis::ShadowQuality m_cachedShadowQuality; @@ -117,7 +117,7 @@ public: virtual void updateTheme(Q3DTheme *theme); virtual void updateFont(const QFont &font); - virtual void updateLabelStyle(QDataVis::LabelStyle style); + virtual void updateLabelBackgroundEnabled(bool enabled); virtual void updateSelectionMode(QDataVis::SelectionFlags newMode); virtual void updateGridEnabled(bool enable); virtual void updateBackgroundEnabled(bool enable); diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp index c243c32b..29215eb0 100644 --- a/src/datavisualization/engine/bars3drenderer.cpp +++ b/src/datavisualization/engine/bars3drenderer.cpp @@ -1914,6 +1914,9 @@ void Bars3DRenderer::updateShadowQuality(QDataVis::ShadowQuality quality) void Bars3DRenderer::loadMeshFile() { + if (m_cachedObjFile.isEmpty()) + return; + QString objectFileName = m_cachedObjFile; if (m_barObj) delete m_barObj; diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp index 5564b6eb..4cb5511a 100644 --- a/src/datavisualization/engine/drawer.cpp +++ b/src/datavisualization/engine/drawer.cpp @@ -44,10 +44,10 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE // Vertex array buffer for point const GLfloat point_data[] = {0.0f, 0.0f, 0.0f}; -Drawer::Drawer(Q3DTheme *theme, const QFont &font, QDataVis::LabelStyle style) +Drawer::Drawer(Q3DTheme *theme, const QFont &font, bool labelBackground) : m_theme(theme), m_font(font), - m_style(style), + m_labelBackground(labelBackground), m_textureHelper(0), m_pointbuffer(0) { @@ -89,9 +89,9 @@ QFont Drawer::font() const return m_font; } -void Drawer::setStyle(QDataVis::LabelStyle style) +void Drawer::setLabelBackground(bool enabled) { - m_style = style; + m_labelBackground = enabled; emit drawerChanged(); } @@ -360,7 +360,7 @@ void Drawer::generateLabelItem(LabelItem &item, const QString &text, int widestL text, m_theme->textBackgroundColor(), m_theme->textColor(), - m_style, + m_labelBackground, m_theme->isLabelBorderEnabled(), widestLabel); diff --git a/src/datavisualization/engine/drawer_p.h b/src/datavisualization/engine/drawer_p.h index f9d70514..c3f92380 100644 --- a/src/datavisualization/engine/drawer_p.h +++ b/src/datavisualization/engine/drawer_p.h @@ -63,7 +63,7 @@ public: }; public: - explicit Drawer(Q3DTheme *theme, const QFont &font, QDataVis::LabelStyle style); + explicit Drawer(Q3DTheme *theme, const QFont &font, bool labelBackground); ~Drawer(); void initializeOpenGL(); @@ -72,7 +72,7 @@ public: Q3DTheme *theme() const; void setFont(const QFont &font); QFont font() const; - void setStyle(QDataVis::LabelStyle style); + void setLabelBackground(bool enabled); void drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId = 0, GLuint depthTextureId = 0); @@ -95,7 +95,7 @@ Q_SIGNALS: private: Q3DTheme *m_theme; QFont m_font; - QDataVis::LabelStyle m_style; + bool m_labelBackground; TextureHelper *m_textureHelper; GLuint m_pointbuffer; }; diff --git a/src/datavisualization/engine/q3dbars.cpp b/src/datavisualization/engine/q3dbars.cpp index 9b2b3646..52db2100 100644 --- a/src/datavisualization/engine/q3dbars.cpp +++ b/src/datavisualization/engine/q3dbars.cpp @@ -104,20 +104,12 @@ Q3DBars::Q3DBars() d_ptr->m_shared->initializeOpenGL(); QObject::connect(d_ptr->m_shared, &Abstract3DController::selectionModeChanged, this, &Q3DBars::selectionModeChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::labelStyleChanged, this, - &Q3DBars::labelStyleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::shadowQualityChanged, this, &Q3DBars::shadowQualityChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::meshFileNameChanged, this, &Q3DBars::meshFileNameChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::fontChanged, this, - &Q3DBars::fontChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::themeChanged, this, &Q3DBars::themeChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::gridVisibleChanged, this, - &Q3DBars::gridVisibleChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::backgroundVisibleChanged, this, - &Q3DBars::backgroundVisibleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::colorStyleChanged, this, &Q3DBars::colorStyleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::objectColorChanged, this, @@ -371,21 +363,6 @@ QString Q3DBars::meshFileName() const return d_ptr->m_shared->meshFileName(); } -/*! - * \property Q3DBars::font - * - * Sets the \a font for labels. It is preset to \c Arial by default. - */ -void Q3DBars::setFont(const QFont &font) -{ - d_ptr->m_shared->setFont(font); -} - -QFont Q3DBars::font() const -{ - return d_ptr->m_shared->font(); -} - /*! * \property Q3DBars::scene * @@ -396,52 +373,6 @@ Q3DScene *Q3DBars::scene() const return d_ptr->m_shared->scene(); } -/*! - * \property Q3DBars::labelStyle - * - * Sets label \a style to one of \c QDataVis::LabelStyle. It is preset to - * \c QDataVis::LabelStyleFromTheme by default. - */ -void Q3DBars::setLabelStyle(QDataVis::LabelStyle style) -{ - d_ptr->m_shared->setLabelStyle(style); -} - -QDataVis::LabelStyle Q3DBars::labelStyle() const -{ - return d_ptr->m_shared->labelStyle(); -} - -/*! - * \property Q3DBars::gridVisible - * - * Sets grid visibility to \a visible. It is preset to \c true by default. - */ -void Q3DBars::setGridVisible(bool visible) -{ - d_ptr->m_shared->setGridEnabled(visible); -} - -bool Q3DBars::isGridVisible() const -{ - return d_ptr->m_shared->gridEnabled(); -} - -/*! - * \property Q3DBars::backgroundVisible - * - * Sets background visibility to \a visible. It is preset to \c true by default. - */ -void Q3DBars::setBackgroundVisible(bool visible) -{ - d_ptr->m_shared->setBackgroundEnabled(visible); -} - -bool Q3DBars::isBackgroundVisible() const -{ - return d_ptr->m_shared->backgroundEnabled(); -} - /*! * \property Q3DBars::shadowQuality * @@ -490,12 +421,12 @@ QDataVis::ColorStyle Q3DBars::colorStyle() const */ void Q3DBars::setBarColor(const QColor &color) { - d_ptr->m_shared->setObjectColor(color); + d_ptr->m_shared->setBaseColor(color); } QColor Q3DBars::barColor() const { - return d_ptr->m_shared->objectColor(); + return d_ptr->m_shared->baseColor(); } /*! @@ -508,12 +439,12 @@ QColor Q3DBars::barColor() const */ void Q3DBars::setBarGradient(const QLinearGradient &gradient) { - d_ptr->m_shared->setObjectGradient(gradient); + d_ptr->m_shared->setBaseGradient(gradient); } QLinearGradient Q3DBars::barGradient() const { - return d_ptr->m_shared->objectGradient(); + return d_ptr->m_shared->baseGradient(); } /*! diff --git a/src/datavisualization/engine/q3dbars.h b/src/datavisualization/engine/q3dbars.h index 15199b7c..c08db74a 100644 --- a/src/datavisualization/engine/q3dbars.h +++ b/src/datavisualization/engine/q3dbars.h @@ -38,16 +38,12 @@ class QT_DATAVISUALIZATION_EXPORT Q3DBars : public Q3DWindow { Q_OBJECT Q_PROPERTY(QtDataVisualization::QDataVis::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged) - Q_PROPERTY(QtDataVisualization::QDataVis::LabelStyle labelStyle READ labelStyle WRITE setLabelStyle NOTIFY labelStyleChanged) Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged) Q_PROPERTY(float barThickness READ barThickness WRITE setBarThickness NOTIFY barThicknessChanged) Q_PROPERTY(QSizeF barSpacing READ barSpacing WRITE setBarSpacing NOTIFY barSpacingChanged) Q_PROPERTY(bool barSpacingRelative READ isBarSpacingRelative WRITE setBarSpacingRelative NOTIFY barSpacingRelativeChanged) Q_PROPERTY(QString meshFileName READ meshFileName WRITE setMeshFileName NOTIFY meshFileNameChanged) - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged) - Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible NOTIFY gridVisibleChanged) - Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) Q_PROPERTY(Q3DScene* scene READ scene) Q_PROPERTY(QtDataVisualization::QDataVis::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged) Q_PROPERTY(QColor barColor READ barColor WRITE setBarColor NOTIFY barColorChanged) @@ -87,23 +83,11 @@ public: void setSelectionMode(QDataVis::SelectionFlags mode); QDataVis::SelectionFlags selectionMode() const; - void setFont(const QFont &font); - QFont font() const; - Q3DScene *scene() const; - void setLabelStyle(QDataVis::LabelStyle style); - QDataVis::LabelStyle labelStyle() const; - - void setGridVisible(bool visible); - bool isGridVisible() const; - void setWidth(const int width); void setHeight(const int height); - void setBackgroundVisible(bool visible); - bool isBackgroundVisible() const; - void setShadowQuality(QDataVis::ShadowQuality quality); QDataVis::ShadowQuality shadowQuality() const; @@ -135,16 +119,12 @@ public: signals: void selectionModeChanged(QDataVis::SelectionFlags mode); - void labelStyleChanged(QDataVis::LabelStyle style); void shadowQualityChanged(QDataVis::ShadowQuality quality); void barThicknessChanged(float thicknessRatio); void barSpacingChanged(QSizeF spacing); void barSpacingRelativeChanged(bool relative); void meshFileNameChanged(QString filename); - void fontChanged(QFont font); void themeChanged(Q3DTheme *theme); - void gridVisibleChanged(bool visible); - void backgroundVisibleChanged(bool visible); void colorStyleChanged(QDataVis::ColorStyle style); void barColorChanged(QColor color); void barGradientChanged(QLinearGradient gradient); diff --git a/src/datavisualization/engine/q3dscatter.cpp b/src/datavisualization/engine/q3dscatter.cpp index d32c8ca2..acacaa8f 100644 --- a/src/datavisualization/engine/q3dscatter.cpp +++ b/src/datavisualization/engine/q3dscatter.cpp @@ -88,20 +88,12 @@ Q3DScatter::Q3DScatter() d_ptr->m_shared->initializeOpenGL(); QObject::connect(d_ptr->m_shared, &Abstract3DController::selectionModeChanged, this, &Q3DScatter::selectionModeChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::labelStyleChanged, this, - &Q3DScatter::labelStyleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::shadowQualityChanged, this, &Q3DScatter::shadowQualityChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::meshFileNameChanged, this, &Q3DScatter::meshFileNameChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::fontChanged, this, - &Q3DScatter::fontChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::themeChanged, this, &Q3DScatter::themeChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::gridVisibleChanged, this, - &Q3DScatter::gridVisibleChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::backgroundVisibleChanged, this, - &Q3DScatter::backgroundVisibleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::colorStyleChanged, this, &Q3DScatter::colorStyleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::objectColorChanged, this, @@ -292,21 +284,6 @@ QString Q3DScatter::meshFileName() const return d_ptr->m_shared->meshFileName(); } -/*! - * \property Q3DScatter::font - * - * Sets the \a font for labels. It is preset to \c Arial by default. - */ -void Q3DScatter::setFont(const QFont &font) -{ - d_ptr->m_shared->setFont(font); -} - -QFont Q3DScatter::font() const -{ - return d_ptr->m_shared->font(); -} - /*! * \property Q3DScatter::scene * @@ -317,52 +294,6 @@ Q3DScene *Q3DScatter::scene() const return d_ptr->m_shared->scene(); } -/*! - * \property Q3DScatter::labelStyle - * - * Sets label \a style to one of \c QDataVis::LabelStyle. It is preset to - * \c QDataVis::LabelStyleFromTheme by default. - */ -void Q3DScatter::setLabelStyle(QDataVis::LabelStyle style) -{ - d_ptr->m_shared->setLabelStyle(style); -} - -QDataVis::LabelStyle Q3DScatter::labelStyle() const -{ - return d_ptr->m_shared->labelStyle(); -} - -/*! - * \property Q3DScatter::gridVisible - * - * Sets grid visibility to \a visible. It is preset to \c true by default. - */ -void Q3DScatter::setGridVisible(bool visible) -{ - d_ptr->m_shared->setGridEnabled(visible); -} - -bool Q3DScatter::isGridVisible() const -{ - return d_ptr->m_shared->gridEnabled(); -} - -/*! - * \property Q3DScatter::backgroundVisible - * - * Sets background visibility to \a visible. It is preset to \c true by default. - */ -void Q3DScatter::setBackgroundVisible(bool visible) -{ - d_ptr->m_shared->setBackgroundEnabled(visible); -} - -bool Q3DScatter::isBackgroundVisible() const -{ - return d_ptr->m_shared->backgroundEnabled(); -} - /*! * \property Q3DScatter::shadowQuality * @@ -411,12 +342,12 @@ QDataVis::ColorStyle Q3DScatter::colorStyle() const */ void Q3DScatter::setItemColor(const QColor &color) { - d_ptr->m_shared->setObjectColor(color); + d_ptr->m_shared->setBaseColor(color); } QColor Q3DScatter::itemColor() const { - return d_ptr->m_shared->objectColor(); + return d_ptr->m_shared->baseColor(); } /*! @@ -429,12 +360,12 @@ QColor Q3DScatter::itemColor() const */ void Q3DScatter::setItemGradient(const QLinearGradient &gradient) { - d_ptr->m_shared->setObjectGradient(gradient); + d_ptr->m_shared->setBaseGradient(gradient); } QLinearGradient Q3DScatter::itemGradient() const { - return d_ptr->m_shared->objectGradient(); + return d_ptr->m_shared->baseGradient(); } /*! diff --git a/src/datavisualization/engine/q3dscatter.h b/src/datavisualization/engine/q3dscatter.h index 9e2641fb..bec6a647 100644 --- a/src/datavisualization/engine/q3dscatter.h +++ b/src/datavisualization/engine/q3dscatter.h @@ -38,13 +38,9 @@ class QT_DATAVISUALIZATION_EXPORT Q3DScatter : public Q3DWindow { Q_OBJECT Q_PROPERTY(QtDataVisualization::QDataVis::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged) - Q_PROPERTY(QtDataVisualization::QDataVis::LabelStyle labelStyle READ labelStyle WRITE setLabelStyle NOTIFY labelStyleChanged) Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged) Q_PROPERTY(QString meshFileName READ meshFileName WRITE setMeshFileName NOTIFY meshFileNameChanged) - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged) - Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible NOTIFY gridVisibleChanged) - Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) Q_PROPERTY(Q3DScene* scene READ scene) Q_PROPERTY(QtDataVisualization::QDataVis::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged) Q_PROPERTY(QColor itemColor READ itemColor WRITE setItemColor NOTIFY itemColorChanged) @@ -73,23 +69,11 @@ public: void setSelectionMode(QDataVis::SelectionFlags mode); QDataVis::SelectionFlags selectionMode() const; - void setFont(const QFont &font); - QFont font() const; - Q3DScene *scene() const; - void setLabelStyle(QDataVis::LabelStyle style); - QDataVis::LabelStyle labelStyle() const; - - void setGridVisible(bool visible); - bool isGridVisible() const; - void setWidth(const int width); void setHeight(const int height); - void setBackgroundVisible(bool visible); - bool isBackgroundVisible() const; - void setShadowQuality(QDataVis::ShadowQuality quality); QDataVis::ShadowQuality shadowQuality() const; @@ -121,13 +105,9 @@ public: signals: void selectionModeChanged(QDataVis::SelectionFlags mode); - void labelStyleChanged(QDataVis::LabelStyle style); void shadowQualityChanged(QDataVis::ShadowQuality quality); void meshFileNameChanged(QString filename); - void fontChanged(QFont font); void themeChanged(Q3DTheme* theme); - void gridVisibleChanged(bool visible); - void backgroundVisibleChanged(bool visible); void colorStyleChanged(QDataVis::ColorStyle style); void itemColorChanged(QColor color); void itemGradientChanged(QLinearGradient gradient); diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp index a84a5ad6..22b671e1 100644 --- a/src/datavisualization/engine/q3dsurface.cpp +++ b/src/datavisualization/engine/q3dsurface.cpp @@ -101,22 +101,14 @@ Q3DSurface::Q3DSurface() d_ptr->m_shared->initializeOpenGL(); QObject::connect(d_ptr->m_shared, &Abstract3DController::selectionModeChanged, this, &Q3DSurface::selectionModeChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::labelStyleChanged, this, - &Q3DSurface::labelStyleChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::themeChanged, this, &Q3DSurface::themeChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::shadowQualityChanged, this, &Q3DSurface::shadowQualityChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::gridVisibleChanged, this, - &Q3DSurface::gridVisibleChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::backgroundVisibleChanged, this, - &Q3DSurface::backgroundVisibleChanged); QObject::connect(d_ptr->m_shared, &Surface3DController::smoothSurfaceEnabledChanged, this, &Q3DSurface::smoothSurfaceEnabledChanged); QObject::connect(d_ptr->m_shared, &Surface3DController::surfaceGridEnabledChanged, this, &Q3DSurface::surfaceGridEnabledChanged); - QObject::connect(d_ptr->m_shared, &Abstract3DController::fontChanged, this, - &Q3DSurface::fontChanged); QObject::connect(d_ptr->m_shared, &Abstract3DController::needRender, this, &Q3DWindow::renderLater); } @@ -214,36 +206,6 @@ void Q3DSurface::resizeEvent(QResizeEvent *event) d_ptr->m_shared->setHeight(height()); } -/*! - * \property Q3DSurface::gridVisible - * - * Sets grid visibility to \a visible. It is preset to \c true by default. - */ -void Q3DSurface::setGridVisible(bool visible) -{ - d_ptr->m_shared->setGridEnabled(visible); -} - -bool Q3DSurface::isGridVisible() const -{ - return d_ptr->m_shared->gridEnabled(); -} - -/*! - * \property Q3DSurface::backgroundVisible - * - * Sets background visibility to \a visible. It is preset to \c true by default. - */ -void Q3DSurface::setBackgroundVisible(bool visible) -{ - d_ptr->m_shared->setBackgroundEnabled(visible); -} - -bool Q3DSurface::isBackgroundVisible() const -{ - return d_ptr->m_shared->backgroundEnabled(); -} - /*! * \property Q3DSurface::theme * @@ -345,21 +307,6 @@ QLinearGradient Q3DSurface::gradient() const return d_ptr->m_shared->gradient(); } -/*! - * \property Q3DSurface::font - * - * Sets the \a font for labels. It is preset to \c Arial by default. - */ -void Q3DSurface::setFont(const QFont &font) -{ - d_ptr->m_shared->setFont(font); -} - -QFont Q3DSurface::font() const -{ - return d_ptr->m_shared->font(); -} - /*! * \property Q3DSurface::scene * @@ -370,22 +317,6 @@ Q3DScene *Q3DSurface::scene() const return d_ptr->m_shared->scene(); } -/*! - * \property Q3DSurface::labelStyle - * - * Sets label \a style to one of \c QDataVis::LabelStyle. It is preset to - * \c QDataVis::LabelStyleFromTheme by default. - */ -void Q3DSurface::setLabelStyle(QDataVis::LabelStyle style) -{ - d_ptr->m_shared->setLabelStyle(style); -} - -QDataVis::LabelStyle Q3DSurface::labelStyle() const -{ - return d_ptr->m_shared->labelStyle(); -} - /*! * Sets a user-defined X-axis. Implicitly calls addAxis() to transfer ownership * of the \a axis to this graph. diff --git a/src/datavisualization/engine/q3dsurface.h b/src/datavisualization/engine/q3dsurface.h index e34bdad3..2a4a56dd 100644 --- a/src/datavisualization/engine/q3dsurface.h +++ b/src/datavisualization/engine/q3dsurface.h @@ -36,15 +36,11 @@ class QT_DATAVISUALIZATION_EXPORT Q3DSurface : public Q3DWindow { Q_OBJECT Q_PROPERTY(QtDataVisualization::QDataVis::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged) - Q_PROPERTY(QtDataVisualization::QDataVis::LabelStyle labelStyle READ labelStyle WRITE setLabelStyle NOTIFY labelStyleChanged) Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged) Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged) - Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible NOTIFY gridVisibleChanged) - Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) Q_PROPERTY(bool smoothSurfaceEnabled READ isSmoothSurfaceEnabled WRITE setSmoothSurfaceEnabled NOTIFY smoothSurfaceEnabledChanged) Q_PROPERTY(bool surfaceGridEnabled READ isSurfaceGridEnabled WRITE setSurfaceGridEnabled NOTIFY surfaceGridEnabledChanged) Q_PROPERTY(QLinearGradient gradient READ gradient WRITE setGradient) - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(Q3DScene* scene READ scene) public: @@ -55,12 +51,6 @@ public: void removeSeries(QSurface3DSeries *series); QList seriesList(); - void setGridVisible(bool visible); - bool isGridVisible() const; - - void setBackgroundVisible(bool visible); - bool isBackgroundVisible() const; - void setTheme(Q3DTheme *theme); Q3DTheme *theme() const; @@ -91,24 +81,14 @@ public: void releaseAxis(Q3DValueAxis *axis); QList axes() const; - void setFont(const QFont &font); - QFont font() const; - Q3DScene *scene() const; - void setLabelStyle(QDataVis::LabelStyle style); - QDataVis::LabelStyle labelStyle() const; - signals: void selectionModeChanged(QDataVis::SelectionFlags mode); - void labelStyleChanged(QDataVis::LabelStyle style); void themeChanged(Q3DTheme *theme); void shadowQualityChanged(QDataVis::ShadowQuality quality); - void gridVisibleChanged(bool visible); - void backgroundVisibleChanged(bool visible); void smoothSurfaceEnabledChanged(bool enabled); void surfaceGridEnabledChanged(bool visible); - void fontChanged(QFont font); protected: void mouseDoubleClickEvent(QMouseEvent *event); diff --git a/src/datavisualization/engine/selectionpointer.cpp b/src/datavisualization/engine/selectionpointer.cpp index 3dc699a6..25c59026 100644 --- a/src/datavisualization/engine/selectionpointer.cpp +++ b/src/datavisualization/engine/selectionpointer.cpp @@ -45,7 +45,7 @@ SelectionPointer::SelectionPointer(Drawer *drawer) m_textureHelper(0), m_isInitialized(false), m_cachedTheme(drawer->theme()), - m_labelStyle(QDataVis::LabelStyleFromTheme), + m_labelBackground(false), m_drawer(drawer), m_cachedScene(0) { diff --git a/src/datavisualization/engine/selectionpointer_p.h b/src/datavisualization/engine/selectionpointer_p.h index e0b2558c..d3d46e2c 100644 --- a/src/datavisualization/engine/selectionpointer_p.h +++ b/src/datavisualization/engine/selectionpointer_p.h @@ -81,7 +81,7 @@ private: TextureHelper *m_textureHelper; bool m_isInitialized; Q3DTheme *m_cachedTheme; - QDataVis::LabelStyle m_labelStyle; + bool m_labelBackground; LabelItem m_labelItem; Drawer *m_drawer; QRect m_mainViewPort; diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index 28ade504..4c1de83f 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -59,7 +59,7 @@ const uint invalidSelectionId = uint(-1); Surface3DRenderer::Surface3DRenderer(Surface3DController *controller) : Abstract3DRenderer(controller), - m_labelStyle(QDataVis::LabelStyleFromTheme), + m_labelBackground(false), m_font(QFont(QStringLiteral("Arial"))), m_isGridEnabled(true), m_cachedIsSlicingActivated(false), @@ -685,10 +685,8 @@ void Surface3DRenderer::drawSlicedScene() glEnable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glCullFace(GL_BACK); - if (m_cachedLabelStyle > QDataVis::LabelStyleOpaque) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Y Labels to back wall GLfloat posStep = 2.0f * m_axisCacheY.segmentStep() / m_heightNormalizer; @@ -757,8 +755,7 @@ void Surface3DRenderer::drawSlicedScene() glDisable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); - if (m_cachedLabelStyle > QDataVis::LabelStyleOpaque) - glDisable(GL_BLEND); + glDisable(GL_BLEND); // Release label shader m_labelShader->release(); diff --git a/src/datavisualization/engine/surface3drenderer_p.h b/src/datavisualization/engine/surface3drenderer_p.h index 9803f59d..9c1be32b 100644 --- a/src/datavisualization/engine/surface3drenderer_p.h +++ b/src/datavisualization/engine/surface3drenderer_p.h @@ -62,7 +62,7 @@ class QT_DATAVISUALIZATION_EXPORT Surface3DRenderer : public Abstract3DRenderer public: // Visual parameters QRect m_boundingRect; - QDataVis::LabelStyle m_labelStyle; + bool m_labelBackground; QFont m_font; bool m_isGridEnabled; diff --git a/src/datavisualization/global/qdatavisualizationenums.h b/src/datavisualization/global/qdatavisualizationenums.h index 0abc6c20..a3773d0b 100644 --- a/src/datavisualization/global/qdatavisualizationenums.h +++ b/src/datavisualization/global/qdatavisualizationenums.h @@ -126,13 +126,6 @@ public: ShadowQualitySoftHigh }; - // TODO: remove - enum LabelStyle { - LabelStyleOpaque = 0, - LabelStyleFromTheme, - LabelStyleTransparent - }; - // TODO: to theme enum ColorStyle { ColorStyleUniform = 0, diff --git a/src/datavisualization/theme/q3dtheme.cpp b/src/datavisualization/theme/q3dtheme.cpp index e43eb52d..dccaee91 100644 --- a/src/datavisualization/theme/q3dtheme.cpp +++ b/src/datavisualization/theme/q3dtheme.cpp @@ -271,6 +271,62 @@ bool Q3DTheme::isLabelBorderEnabled() const return d_ptr->m_labelBorders; } +void Q3DTheme::setFont(const QFont &font) +{ + if (d_ptr->m_font != font) { + d_ptr->m_dirtyBits.fontDirty = true; + d_ptr->m_font = font; + emit fontChanged(font); + } +} + +QFont Q3DTheme::font() const +{ + return d_ptr->m_font; +} + +void Q3DTheme::setBackgroundEnabled(bool enabled) +{ + if (d_ptr->m_backgoundEnabled != enabled) { + d_ptr->m_dirtyBits.backgroundEnabledDirty = true; + d_ptr->m_backgoundEnabled = enabled; + emit backgroundEnabledChanged(enabled); + } +} + +bool Q3DTheme::isBackgroundEnabled() const +{ + return d_ptr->m_backgoundEnabled; +} + +void Q3DTheme::setGridEnabled(bool enabled) +{ + if (d_ptr->m_gridEnabled != enabled) { + d_ptr->m_dirtyBits.gridEnabledDirty = true; + d_ptr->m_gridEnabled = enabled; + emit gridEnabledChanged(enabled); + } +} + +bool Q3DTheme::isGridEnabled() const +{ + return d_ptr->m_gridEnabled; +} + +void Q3DTheme::setLabelBackgroundEnabled(bool enabled) +{ + if (d_ptr->m_labelBackground != enabled) { + d_ptr->m_dirtyBits.labelBackgroundEnabledDirty = true; + d_ptr->m_labelBackground = enabled; + emit labelBackgroundEnabledChanged(enabled); + } +} + +bool Q3DTheme::isLabelBackgroundEnabled() const +{ + return d_ptr->m_labelBackground; +} + void Q3DTheme::setColorStyle(QDataVis::ColorStyle style) { if (d_ptr->m_colorStyle != style) { @@ -303,6 +359,15 @@ QDataVis::Theme Q3DTheme::type() const Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, QDataVis::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), + m_textBackgroundColor(Qt::gray), + m_gridLineColor(Qt::white), + m_singleHighlightColor(Qt::red), + m_multiHighlightColor(Qt::blue), + m_lightColor(Qt::white), m_baseGradient(QLinearGradient(qreal(gradientTextureWidth), qreal(gradientTextureHeight), 0.0, 0.0)), @@ -312,6 +377,15 @@ Q3DThemePrivate::Q3DThemePrivate(Q3DTheme *q, QDataVis::Theme theme_id) m_multiHighlightGradient(QLinearGradient(qreal(gradientTextureWidth), qreal(gradientTextureHeight), 0.0, 0.0)), + m_lightStrength(0.5f), + m_ambientLightStrength(0.25f), + m_highlightLightStrength(0.75f), + m_labelBorders(true), + m_colorStyle(QDataVis::ColorStyleUniform), + m_font(QFont(QStringLiteral("Arial"))), + m_backgoundEnabled(true), + m_gridEnabled(true), + m_labelBackground(true), q_ptr(q) { } @@ -320,4 +394,29 @@ Q3DThemePrivate::~Q3DThemePrivate() { } +void Q3DThemePrivate::resetDirtyBits() +{ + m_dirtyBits.ambientLightStrengthDirty = false; + m_dirtyBits.backgroundColorDirty = false; + m_dirtyBits.backgroundEnabledDirty = false; + m_dirtyBits.baseColorDirty = false; + m_dirtyBits.baseGradientDirty = false; + m_dirtyBits.colorStyleDirty = false; + m_dirtyBits.fontDirty = false; + m_dirtyBits.gridEnabledDirty = false; + m_dirtyBits.gridLineColorDirty = false; + m_dirtyBits.highlightLightStrengthDirty = false; + m_dirtyBits.labelBackgroundEnabledDirty = false; + m_dirtyBits.labelBorderEnabledDirty = false; + m_dirtyBits.lightColorDirty = false; + m_dirtyBits.lightStrengthDirty = false; + m_dirtyBits.multiHighlightColorDirty = false; + m_dirtyBits.multiHighlightGradientDirty = false; + m_dirtyBits.singleHighlightColorDirty = false; + m_dirtyBits.singleHighlightGradientDirty = false; + m_dirtyBits.textBackgroundColorDirty = false; + m_dirtyBits.textColorDirty = false; + m_dirtyBits.windowColorDirty = false; +} + QT_DATAVISUALIZATION_END_NAMESPACE diff --git a/src/datavisualization/theme/q3dtheme.h b/src/datavisualization/theme/q3dtheme.h index 4cea4341..43e9fd70 100644 --- a/src/datavisualization/theme/q3dtheme.h +++ b/src/datavisualization/theme/q3dtheme.h @@ -21,8 +21,8 @@ #include #include - -class QColor; +#include +#include QT_DATAVISUALIZATION_BEGIN_NAMESPACE @@ -48,6 +48,10 @@ class QT_DATAVISUALIZATION_EXPORT Q3DTheme : public QObject Q_PROPERTY(float ambientLightStrength READ ambientLightStrength WRITE setAmbientLightStrength NOTIFY ambientLightStrengthChanged) Q_PROPERTY(float highlightLightStrength READ highlightLightStrength WRITE setHighlightLightStrength NOTIFY highlightLightStrengthChanged) Q_PROPERTY(bool labelBorderEnabled READ isLabelBorderEnabled WRITE setLabelBorderEnabled NOTIFY labelBorderEnabledChanged) + Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) + Q_PROPERTY(bool backgroundEnabled READ isBackgroundEnabled WRITE setBackgroundEnabled NOTIFY backgroundEnabledChanged) + Q_PROPERTY(bool gridEnabled READ isGridEnabled WRITE setGridEnabled NOTIFY gridEnabledChanged) + Q_PROPERTY(bool labelBackgroundEnabled READ isLabelBackgroundEnabled WRITE setLabelBackgroundEnabled NOTIFY labelBackgroundEnabledChanged) Q_PROPERTY(QtDataVisualization::QDataVis::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged) // TODO: Add everything that we need @@ -107,6 +111,18 @@ public: void setLabelBorderEnabled(bool enabled); bool isLabelBorderEnabled() const; + void setFont(const QFont &font); + QFont font() const; + + void setBackgroundEnabled(bool enabled); + bool isBackgroundEnabled() const; + + void setGridEnabled(bool enabled); + bool isGridEnabled() const; + + void setLabelBackgroundEnabled(bool enabled); + bool isLabelBackgroundEnabled() const; + void setColorStyle(QDataVis::ColorStyle style); QDataVis::ColorStyle colorStyle() const; @@ -128,6 +144,10 @@ signals: void ambientLightStrengthChanged(float strength); void highlightLightStrengthChanged(float strength); void labelBorderEnabledChanged(bool enabled); + void fontChanged(QFont font); + void backgroundEnabledChanged(bool enabled); + void gridEnabledChanged(bool enabled); + void labelBackgroundEnabledChanged(bool enabled); void colorStyleChanged(QDataVis::ColorStyle style); protected: diff --git a/src/datavisualization/theme/q3dtheme_p.h b/src/datavisualization/theme/q3dtheme_p.h index ca3108c8..08efa61e 100644 --- a/src/datavisualization/theme/q3dtheme_p.h +++ b/src/datavisualization/theme/q3dtheme_p.h @@ -32,9 +32,6 @@ #include "datavisualizationglobal_p.h" #include "q3dtheme.h" -class QColor; -class QLinearGradient; - QT_DATAVISUALIZATION_BEGIN_NAMESPACE struct Q3DThemeDirtyBitField { @@ -55,6 +52,10 @@ struct Q3DThemeDirtyBitField { bool highlightLightStrengthDirty : 1; bool labelBorderEnabledDirty : 1; bool colorStyleDirty : 1; + bool fontDirty : 1; + bool backgroundEnabledDirty : 1; + bool gridEnabledDirty : 1; + bool labelBackgroundEnabledDirty : 1; Q3DThemeDirtyBitField() : baseColorDirty(false), @@ -73,7 +74,11 @@ struct Q3DThemeDirtyBitField { ambientLightStrengthDirty(false), highlightLightStrengthDirty(false), labelBorderEnabledDirty(false), - colorStyleDirty(false) + colorStyleDirty(false), + fontDirty(false), + backgroundEnabledDirty(false), + gridEnabledDirty(false), + labelBackgroundEnabledDirty(false) { } }; @@ -86,14 +91,14 @@ public: QDataVis::Theme theme_id = QDataVis::ThemeUserDefined); virtual ~Q3DThemePrivate(); + void resetDirtyBits(); + public: QDataVis::Theme m_themeId; Q3DThemeDirtyBitField m_dirtyBits; QColor m_baseColor; - QColor m_heightColor; - QColor m_depthColor; QColor m_backgroundColor; QColor m_windowColor; QColor m_textColor; @@ -110,6 +115,10 @@ public: float m_highlightLightStrength; bool m_labelBorders; QDataVis::ColorStyle m_colorStyle; + QFont m_font; + bool m_backgoundEnabled; + bool m_gridEnabled; + bool m_labelBackground; protected: Q3DTheme *q_ptr; diff --git a/src/datavisualization/theme/thememanager.cpp b/src/datavisualization/theme/thememanager.cpp index 168409b3..36a879bf 100644 --- a/src/datavisualization/theme/thememanager.cpp +++ b/src/datavisualization/theme/thememanager.cpp @@ -47,8 +47,10 @@ void ThemeManager::setTheme(Q3DTheme *theme) QDataVis::Theme type = m_theme->type(); - if (type != QDataVis::ThemeUserDefined) + if (type != QDataVis::ThemeUserDefined) { useTheme(type); + m_theme->d_ptr->resetDirtyBits(); + } // Connect signals from new one connectThemeSignals(); @@ -62,39 +64,46 @@ Q3DTheme *ThemeManager::theme() const void ThemeManager::connectThemeSignals() { - // TODO: Implement receiving end for the commented ones (QTRD-2538) connect(m_theme.data(), &Q3DTheme::baseColorChanged, - m_controller, &Abstract3DController::setObjectColor); - // connect(m_theme.data(), &Q3DTheme::backgroundColorChanged, - // m_controller, &Abstract3DController::setBackgroundColorColor); - // connect(m_theme.data(), &Q3DTheme::windowColorChanged, - // m_controller, &Abstract3DController::setWindowColor); - // connect(m_theme.data(), &Q3DTheme::textColorChanged, - // m_controller, &Abstract3DController::setTextColor); - // connect(m_theme.data(), &Q3DTheme::textBackgroundColorChanged, - // m_controller, &Abstract3DController::setTextBackgroundColor); - // connect(m_theme.data(), &Q3DTheme::gridLineColorChanged, - // m_controller, &Abstract3DController::setGridLineColor); + m_controller, &Abstract3DController::setBaseColor); +// connect(m_theme.data(), &Q3DTheme::backgroundColorChanged, +// m_controller, &Abstract3DController::setBackgroundColor); +// connect(m_theme.data(), &Q3DTheme::windowColorChanged, +// m_controller, &Abstract3DController::setWindowColor); +// connect(m_theme.data(), &Q3DTheme::textColorChanged, +// m_controller, &Abstract3DController::setTextColor); +// connect(m_theme.data(), &Q3DTheme::textBackgroundColorChanged, +// m_controller, &Abstract3DController::setTextBackgroundColor); +// connect(m_theme.data(), &Q3DTheme::gridLineColorChanged, +// m_controller, &Abstract3DController::setGridLineColor); connect(m_theme.data(), &Q3DTheme::singleHighlightColorChanged, m_controller, &Abstract3DController::setSingleHighlightColor); connect(m_theme.data(), &Q3DTheme::multiHighlightColorChanged, m_controller, &Abstract3DController::setMultiHighlightColor); - // connect(m_theme.data(), &Q3DTheme::lightColorChanged, - // m_controller, &Abstract3DController::setLightColor); +// connect(m_theme.data(), &Q3DTheme::lightColorChanged, +// m_controller, &Abstract3DController::setLightColor); connect(m_theme.data(), &Q3DTheme::baseGradientChanged, - m_controller, &Abstract3DController::setObjectGradient); + m_controller, &Abstract3DController::setBaseGradient); connect(m_theme.data(), &Q3DTheme::singleHighlightGradientChanged, m_controller, &Abstract3DController::setSingleHighlightGradient); connect(m_theme.data(), &Q3DTheme::multiHighlightGradientChanged, m_controller, &Abstract3DController::setMultiHighlightGradient); - // connect(m_theme.data(), &Q3DTheme::lightStrengthChanged, - // m_controller, &Abstract3DController::setLightStrength); - // connect(m_theme.data(), &Q3DTheme::ambientLightStrengthChanged, - // m_controller, &Abstract3DController::setAmbientLightStrength); - // connect(m_theme.data(), &Q3DTheme::highlightLightStrengthChanged, - // m_controller, &Abstract3DController::setHighlightLightStrength); - // connect(m_theme.data(), &Q3DTheme::labelBorderEnabledChanged, - // m_controller, &Abstract3DController::setLabelBorderEnabled); +// connect(m_theme.data(), &Q3DTheme::lightStrengthChanged, +// m_controller, &Abstract3DController::setLightStrength); +// connect(m_theme.data(), &Q3DTheme::ambientLightStrengthChanged, +// m_controller, &Abstract3DController::setAmbientLightStrength); +// connect(m_theme.data(), &Q3DTheme::highlightLightStrengthChanged, +// m_controller, &Abstract3DController::setHighlightLightStrength); +// connect(m_theme.data(), &Q3DTheme::labelBorderEnabledChanged, +// m_controller, &Abstract3DController::setLabelBorderEnabled); + connect(m_theme.data(), &Q3DTheme::fontChanged, + m_controller, &Abstract3DController::setFont); + connect(m_theme.data(), &Q3DTheme::backgroundEnabledChanged, + m_controller, &Abstract3DController::setBackgroundEnabled); + connect(m_theme.data(), &Q3DTheme::gridEnabledChanged, + m_controller, &Abstract3DController::setGridEnabled); + connect(m_theme.data(), &Q3DTheme::labelBackgroundEnabledChanged, + m_controller, &Abstract3DController::setLabelBackgroundEnabled); connect(m_theme.data(), &Q3DTheme::colorStyleChanged, m_controller, &Abstract3DController::setColorStyle); @@ -108,6 +117,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) switch (type) { case QDataVis::ThemeQt: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0x80c342))); setBackgroundColor(QColor(QRgb(0xffffff))); setWindowColor(QColor(QRgb(0xffffff))); @@ -146,6 +160,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemePrimaryColors: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0xffe400))); setBackgroundColor(QColor(QRgb(0xffffff))); setWindowColor(QColor(QRgb(0xffffff))); @@ -184,6 +203,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemeDigia: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0xcccccc))); setBackgroundColor(QColor(QRgb(0xffffff))); setWindowColor(QColor(QRgb(0xffffff))); @@ -222,6 +246,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemeStoneMoss: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0xbeb32b))); setBackgroundColor(QColor(QRgb(0x4d4d4f))); setWindowColor(QColor(QRgb(0x4d4d4f))); @@ -260,6 +289,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemeArmyBlue: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0x495f76))); setBackgroundColor(QColor(QRgb(0xd5d6d7))); setWindowColor(QColor(QRgb(0xd5d6d7))); @@ -298,6 +332,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemeRetro: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0x533b23))); setBackgroundColor(QColor(QRgb(0xe9e2ce))); setWindowColor(QColor(QRgb(0xe9e2ce))); @@ -336,6 +375,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemeEbony: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0xffffff))); setBackgroundColor(QColor(QRgb(0x000000))); setWindowColor(QColor(QRgb(0x000000))); @@ -374,6 +418,11 @@ void ThemeManager::useTheme(QDataVis::Theme type) } case QDataVis::ThemeIsabelle: { + setBackgroundEnabled(true); + setGridEnabled(true); + setFont(QFont(QStringLiteral("Arial"))); + setLabelBackgroundEnabled(true); + setLightColor(Qt::white); setBaseColor(QColor(QRgb(0xf9d900))); setBackgroundColor(QColor(QRgb(0x000000))); setWindowColor(QColor(QRgb(0x000000))); @@ -511,6 +560,30 @@ void ThemeManager::setLabelBorderEnabled(bool enabled) m_theme->setLabelBorderEnabled(enabled); } +void ThemeManager::setFont(const QFont &font) +{ + if (!m_theme->d_ptr->m_dirtyBits.fontDirty) + m_theme->setFont(font); +} + +void ThemeManager::setBackgroundEnabled(bool enabled) +{ + if (!m_theme->d_ptr->m_dirtyBits.backgroundEnabledDirty) + m_theme->setBackgroundEnabled(enabled); +} + +void ThemeManager::setGridEnabled(bool enabled) +{ + if (!m_theme->d_ptr->m_dirtyBits.gridEnabledDirty) + m_theme->setGridEnabled(enabled); +} + +void ThemeManager::setLabelBackgroundEnabled(bool enabled) +{ + if (!m_theme->d_ptr->m_dirtyBits.labelBackgroundEnabledDirty) + m_theme->setLabelBackgroundEnabled(enabled); +} + void ThemeManager::setColorStyle(QDataVis::ColorStyle style) { if (!m_theme->d_ptr->m_dirtyBits.colorStyleDirty) diff --git a/src/datavisualization/theme/thememanager_p.h b/src/datavisualization/theme/thememanager_p.h index 26ae6282..33277105 100644 --- a/src/datavisualization/theme/thememanager_p.h +++ b/src/datavisualization/theme/thememanager_p.h @@ -64,6 +64,10 @@ protected: 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(QDataVis::ColorStyle style); private: diff --git a/src/datavisualization/utils/utils.cpp b/src/datavisualization/utils/utils.cpp index ce033dc0..2adc9409 100644 --- a/src/datavisualization/utils/utils.cpp +++ b/src/datavisualization/utils/utils.cpp @@ -45,7 +45,7 @@ QVector3D Utils::vectorFromColor(const QColor &color) } QImage Utils::printTextToImage(const QFont &font, const QString &text, const QColor &bgrColor, - const QColor &txtColor, QDataVis::LabelStyle style, + const QColor &txtColor, bool labelBackground, bool borders, int maxLabelWidth) { GLuint paddingWidth = 20; @@ -55,7 +55,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo valueFont.setPointSize(textureFontSize); QFontMetrics valueFM(valueFont); int valueStrWidth = valueFM.width(text); - if (maxLabelWidth && QDataVis::LabelStyleTransparent != style) + if (maxLabelWidth && !labelBackground) valueStrWidth = maxLabelWidth; int valueStrHeight = valueFM.height(); valueStrWidth += paddingWidth / 2; // Fix clipping problem with skewed fonts (italic or italic-style) @@ -74,7 +74,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo labelSize.setHeight(getNearestPowerOfTwo(labelSize.height(), paddingHeight)); //qDebug() << "label size after padding" << labelSize << paddingWidth << paddingHeight; #else - if (QDataVis::LabelStyleTransparent == style) + if (!labelBackground) labelSize = QSize(valueStrWidth, valueStrHeight); else labelSize = QSize(valueStrWidth + paddingWidth * 2, valueStrHeight + paddingHeight * 2); @@ -90,8 +90,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo painter.setRenderHint(QPainter::Antialiasing, true); painter.setCompositionMode(QPainter::CompositionMode_Source); painter.setFont(valueFont); - switch (style) { - case QDataVis::LabelStyleTransparent: { + if (!labelBackground) { painter.setPen(txtColor); #if defined(Q_OS_ANDROID) painter.drawText((labelSize.width() - valueStrWidth) / 2.0f, @@ -105,9 +104,7 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo Qt::AlignCenter | Qt::AlignVCenter, text); #endif - break; - } - case QDataVis::LabelStyleFromTheme: { + } else { painter.setBrush(QBrush(bgrColor)); if (borders) { painter.setPen(QPen(QBrush(txtColor), 5, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin)); @@ -123,27 +120,6 @@ QImage Utils::printTextToImage(const QFont &font, const QString &text, const QCo valueStrWidth, valueStrHeight, Qt::AlignCenter | Qt::AlignVCenter, text); - break; - } - case QDataVis::LabelStyleOpaque: { - QColor labelColor = QColor(bgrColor); - labelColor.setAlphaF(1.0); - painter.setBrush(QBrush(labelColor)); - if (borders) { - painter.setPen(QPen(QBrush(txtColor), 7, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin)); - painter.drawRect(7, 7, labelSize.width() - 14, labelSize.height() - 14); - } else { - painter.setPen(labelColor); - painter.drawRect(0, 0, labelSize.width(), labelSize.height()); - } - painter.setPen(txtColor); - painter.drawText((labelSize.width() - valueStrWidth) / 2.0f, - (labelSize.height() - valueStrHeight) / 2.0f, - valueStrWidth, valueStrHeight, - Qt::AlignCenter | Qt::AlignVCenter, - text); - break; - } } return image; } diff --git a/src/datavisualization/utils/utils_p.h b/src/datavisualization/utils/utils_p.h index 4d09a639..b713db94 100644 --- a/src/datavisualization/utils/utils_p.h +++ b/src/datavisualization/utils/utils_p.h @@ -59,7 +59,7 @@ public: const QString &text, const QColor &bgrColor, const QColor &txtColor, - QDataVis::LabelStyle style, + bool labelBackground, bool borders = false, int maxLabelWidth = 0); static QVector3D getSelection(QPoint mousepos, int height); diff --git a/src/datavisualizationqml2/abstractdeclarative.cpp b/src/datavisualizationqml2/abstractdeclarative.cpp index 06c68cb0..a22caf9f 100644 --- a/src/datavisualizationqml2/abstractdeclarative.cpp +++ b/src/datavisualizationqml2/abstractdeclarative.cpp @@ -55,46 +55,6 @@ QDataVis::SelectionFlags AbstractDeclarative::selectionMode() const return m_controller->selectionMode(); } -void AbstractDeclarative::setFont(const QFont &font) -{ - m_controller->setFont(font); -} - -QFont AbstractDeclarative::font() const -{ - return m_controller->font(); -} - -void AbstractDeclarative::setLabelStyle(QDataVis::LabelStyle style) -{ - m_controller->setLabelStyle(style); -} - -QDataVis::LabelStyle AbstractDeclarative::labelStyle() const -{ - return m_controller->labelStyle(); -} - -void AbstractDeclarative::setGridVisible(bool visible) -{ - m_controller->setGridEnabled(visible); -} - -bool AbstractDeclarative::isGridVisible() const -{ - return m_controller->gridEnabled(); -} - -void AbstractDeclarative::setBackgroundVisible(bool visible) -{ - m_controller->setBackgroundEnabled(visible); -} - -bool AbstractDeclarative::isBackgroundVisible() const -{ - return m_controller->backgroundEnabled(); -} - void AbstractDeclarative::setShadowQuality(QDataVis::ShadowQuality quality) { m_controller->setShadowQuality(quality); @@ -115,16 +75,8 @@ void AbstractDeclarative::setSharedController(Abstract3DController *controller) &AbstractDeclarative::inputHandlerChanged); QObject::connect(m_controller, &Abstract3DController::themeChanged, this, &AbstractDeclarative::themeChanged); - QObject::connect(m_controller, &Abstract3DController::fontChanged, this, - &AbstractDeclarative::fontChanged); QObject::connect(m_controller, &Abstract3DController::selectionModeChanged, this, &AbstractDeclarative::selectionModeChanged); - QObject::connect(m_controller, &Abstract3DController::labelStyleChanged, this, - &AbstractDeclarative::labelStyleChanged); - QObject::connect(m_controller, &Abstract3DController::backgroundVisibleChanged, this, - &AbstractDeclarative::backgroundVisibleChanged); - QObject::connect(m_controller, &Abstract3DController::gridVisibleChanged, this, - &AbstractDeclarative::gridVisibleChanged); } QAbstract3DInputHandler* AbstractDeclarative::inputHandler() const diff --git a/src/datavisualizationqml2/abstractdeclarative_p.h b/src/datavisualizationqml2/abstractdeclarative_p.h index 27572f7b..7811a44e 100644 --- a/src/datavisualizationqml2/abstractdeclarative_p.h +++ b/src/datavisualizationqml2/abstractdeclarative_p.h @@ -43,14 +43,10 @@ class AbstractDeclarative : public QQuickItem { Q_OBJECT Q_PROPERTY(QtDataVisualization::QDataVis::SelectionFlags selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged) - Q_PROPERTY(QtDataVisualization::QDataVis::LabelStyle labelStyle READ labelStyle WRITE setLabelStyle NOTIFY labelStyleChanged) Q_PROPERTY(QtDataVisualization::QDataVis::ShadowQuality shadowQuality READ shadowQuality WRITE setShadowQuality NOTIFY shadowQualityChanged) Q_PROPERTY(Q3DScene* scene READ scene) Q_PROPERTY(QAbstract3DInputHandler* inputHandler READ inputHandler WRITE setInputHandler NOTIFY inputHandlerChanged) Q_PROPERTY(Q3DTheme* theme READ theme WRITE setTheme NOTIFY themeChanged) - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) - Q_PROPERTY(bool gridVisible READ isGridVisible WRITE setGridVisible NOTIFY gridVisibleChanged) - Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible NOTIFY backgroundVisibleChanged) public: explicit AbstractDeclarative(QQuickItem *parent = 0); @@ -67,18 +63,6 @@ public: virtual void setSelectionMode(QDataVis::SelectionFlags mode); virtual QDataVis::SelectionFlags selectionMode() const; - virtual void setFont(const QFont &font); - virtual QFont font() const; - - virtual void setLabelStyle(QDataVis::LabelStyle style); - virtual QDataVis::LabelStyle labelStyle() const; - - virtual void setGridVisible(bool visible); - virtual bool isGridVisible() const; - - virtual void setBackgroundVisible(bool visible); - virtual bool isBackgroundVisible() const; - virtual void setShadowQuality(QDataVis::ShadowQuality quality); virtual QDataVis::ShadowQuality shadowQuality() const; @@ -97,11 +81,7 @@ signals: void shadowQualityChanged(QDataVis::ShadowQuality quality); void inputHandlerChanged(QAbstract3DInputHandler *inputHandler); void themeChanged(Q3DTheme *theme); - void fontChanged(QFont font); void selectionModeChanged(QDataVis::SelectionFlags mode); - void labelStyleChanged(QDataVis::LabelStyle style); - void backgroundVisibleChanged(bool visible); - void gridVisibleChanged(bool visible); void itemLabelFormatChanged(QString format); private: diff --git a/src/datavisualizationqml2/declarativebars.cpp b/src/datavisualizationqml2/declarativebars.cpp index e7bb2683..ab08765e 100644 --- a/src/datavisualizationqml2/declarativebars.cpp +++ b/src/datavisualizationqml2/declarativebars.cpp @@ -74,7 +74,7 @@ QSGNode *DeclarativeBars::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData void DeclarativeBars::setBarColor(const QColor &baseColor) { - m_shared->setObjectColor(baseColor); + m_shared->setBaseColor(baseColor); } Q3DCategoryAxis *DeclarativeBars::rowAxis() const diff --git a/src/datavisualizationqml2/declarativescatter.cpp b/src/datavisualizationqml2/declarativescatter.cpp index 52c75962..7efcf8a6 100644 --- a/src/datavisualizationqml2/declarativescatter.cpp +++ b/src/datavisualizationqml2/declarativescatter.cpp @@ -74,7 +74,7 @@ QSGNode *DeclarativeScatter::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa void DeclarativeScatter::setObjectColor(const QColor &baseColor) { - m_shared->setObjectColor(baseColor); + m_shared->setBaseColor(baseColor); } Q3DValueAxis *DeclarativeScatter::axisX() const -- cgit v1.2.3