summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp8
-rw-r--r--src/datavisualization/engine/bars3dcontroller.cpp20
-rw-r--r--src/datavisualization/engine/drawer.cpp28
-rw-r--r--src/datavisualization/engine/drawer_p.h4
-rw-r--r--src/datavisualization/theme/q3dtheme.cpp32
5 files changed, 24 insertions, 68 deletions
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
index 95840b0a..350da1fc 100644
--- a/src/datavisualization/engine/abstract3drenderer.cpp
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -162,14 +162,10 @@ void Abstract3DRenderer::initGradientShaders(const QString &vertexShader, const
void Abstract3DRenderer::updateTheme(Q3DTheme *theme)
{
// Synchronize the controller theme with renderer
- bool changed = theme->d_ptr->sync(*m_cachedTheme->d_ptr);
+ bool updateDrawer = theme->d_ptr->sync(*m_cachedTheme->d_ptr);
- if (changed) {
- // Update drawer if sync changed something
+ if (updateDrawer)
m_drawer->setTheme(m_cachedTheme);
- // Re-initialize shaders
- reInitShaders();
- }
}
void Abstract3DRenderer::updateScene(Q3DScene *scene)
diff --git a/src/datavisualization/engine/bars3dcontroller.cpp b/src/datavisualization/engine/bars3dcontroller.cpp
index 5542b69b..d85e474c 100644
--- a/src/datavisualization/engine/bars3dcontroller.cpp
+++ b/src/datavisualization/engine/bars3dcontroller.cpp
@@ -166,6 +166,16 @@ void Bars3DController::handleRowsInserted(int startIndex, int count)
adjustAxisRanges();
m_isDataDirty = true;
}
+
+ if (series == m_selectedBarSeries) {
+ // If rows inserted to selected series before the selection, adjust the selection
+ int selectedRow = m_selectedBar.x();
+ if (startIndex <= selectedRow) {
+ selectedRow += count;
+ setSelectedBar(QPoint(selectedRow, m_selectedBar.y()), m_selectedBarSeries);
+ }
+ }
+
emitNeedRender();
}
@@ -178,16 +188,6 @@ void Bars3DController::handleItemChanged(int rowIndex, int columnIndex)
adjustAxisRanges();
m_isDataDirty = true;
}
-
- if (series == m_selectedBarSeries) {
- // If rows inserted to selected series before the selection, adjust the selection
- int selectedRow = m_selectedBar.x();
- if (startIndex <= selectedRow) {
- selectedRow += count;
- setSelectedBar(QPoint(selectedRow, m_selectedBar.y()), m_selectedBarSeries);
- }
- }
-
emitNeedRender();
}
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index 72b64212..dde0def2 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -45,8 +45,6 @@ const GLfloat point_data[] = {0.0f, 0.0f, 0.0f};
Drawer::Drawer(Q3DTheme *theme)
: m_theme(theme),
- m_font(theme->font()),
- m_labelBackground(theme->isLabelBackgroundEnabled()),
m_textureHelper(0),
m_pointbuffer(0)
{
@@ -70,8 +68,6 @@ void Drawer::initializeOpenGL()
void Drawer::setTheme(Q3DTheme *theme)
{
m_theme = theme;
- m_font = m_theme->font();
- m_labelBackground = m_theme->isLabelBackgroundEnabled();
emit drawerChanged();
}
@@ -80,25 +76,9 @@ Q3DTheme *Drawer::theme() const
return m_theme;
}
-void Drawer::setFont(const QFont &font)
-{
- // We need to be able to override theme's font for drawer
- // TODO: (or do we?)
- m_font = font;
- emit drawerChanged();
-}
-
QFont Drawer::font() const
{
- return m_font;
-}
-
-void Drawer::setLabelBackground(bool enabled)
-{
- // We need to be able to override theme's label background for drawer
- // TODO: (or do we?)
- m_labelBackground = enabled;
- emit drawerChanged();
+ return m_theme->font();
}
void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId,
@@ -266,7 +246,7 @@ void Drawer::drawLabel(const AbstractRenderItem &item, const LabelItem &labelIte
}
// Calculate scale factor to get uniform font size
- GLfloat scaledFontSize = 0.05f + m_font.pointSizeF() / 500.0f;
+ GLfloat scaledFontSize = 0.05f + m_theme->font().pointSizeF() / 500.0f;
GLfloat scaleFactor = scaledFontSize / (GLfloat)textureSize.height();
// Apply alignment
@@ -385,11 +365,11 @@ void Drawer::generateLabelItem(LabelItem &item, const QString &text, int widestL
if (!text.isEmpty()) {
// Create labels
// Print label into a QImage using QPainter
- QImage label = Utils::printTextToImage(m_font,
+ QImage label = Utils::printTextToImage(m_theme->font(),
text,
m_theme->labelBackgroundColor(),
m_theme->labelTextColor(),
- m_labelBackground,
+ m_theme->isLabelBackgroundEnabled(),
m_theme->isLabelBorderEnabled(),
widestLabel);
diff --git a/src/datavisualization/engine/drawer_p.h b/src/datavisualization/engine/drawer_p.h
index ba9aadf7..d91c48fa 100644
--- a/src/datavisualization/engine/drawer_p.h
+++ b/src/datavisualization/engine/drawer_p.h
@@ -70,9 +70,7 @@ public:
void setTheme(Q3DTheme *theme);
Q3DTheme *theme() const;
- void setFont(const QFont &font);
QFont font() const;
- void setLabelBackground(bool enabled);
void drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId = 0,
GLuint depthTextureId = 0);
@@ -94,8 +92,6 @@ Q_SIGNALS:
private:
Q3DTheme *m_theme;
- QFont m_font;
- bool m_labelBackground;
TextureHelper *m_textureHelper;
GLuint m_pointbuffer;
};
diff --git a/src/datavisualization/theme/q3dtheme.cpp b/src/datavisualization/theme/q3dtheme.cpp
index 30556959..1d331efc 100644
--- a/src/datavisualization/theme/q3dtheme.cpp
+++ b/src/datavisualization/theme/q3dtheme.cpp
@@ -960,118 +960,102 @@ void Q3DThemePrivate::resetDirtyBits()
bool Q3DThemePrivate::sync(Q3DThemePrivate &other)
{
- bool changed = false;
+ bool updateDrawer = false;
if (m_dirtyBits.ambientLightStrengthDirty) {
other.q_ptr->setAmbientLightStrength(m_ambientLightStrength);
m_dirtyBits.ambientLightStrengthDirty = false;
- changed = true;
}
if (m_dirtyBits.backgroundColorDirty) {
other.q_ptr->setBackgroundColor(m_backgroundColor);
m_dirtyBits.backgroundColorDirty = false;
- changed = true;
}
if (m_dirtyBits.backgroundEnabledDirty) {
other.q_ptr->setBackgroundEnabled(m_backgoundEnabled);
m_dirtyBits.backgroundEnabledDirty = false;
- changed = true;
}
if (m_dirtyBits.baseColorDirty) {
other.q_ptr->setBaseColors(m_baseColors);
m_dirtyBits.baseColorDirty = false;
- changed = true;
}
if (m_dirtyBits.baseGradientDirty) {
other.q_ptr->setBaseGradients(m_baseGradients);
m_dirtyBits.baseGradientDirty = false;
- changed = true;
}
if (m_dirtyBits.colorStyleDirty) {
other.q_ptr->setColorStyle(m_colorStyle);
m_dirtyBits.colorStyleDirty = false;
- changed = true;
}
if (m_dirtyBits.fontDirty) {
other.q_ptr->setFont(m_font);
m_dirtyBits.fontDirty = false;
- changed = true;
+ updateDrawer = true;
}
if (m_dirtyBits.gridEnabledDirty) {
other.q_ptr->setGridEnabled(m_gridEnabled);
m_dirtyBits.gridEnabledDirty = false;
- changed = true;
}
if (m_dirtyBits.gridLineColorDirty) {
other.q_ptr->setGridLineColor(m_gridLineColor);
m_dirtyBits.gridLineColorDirty = false;
- changed = true;
}
if (m_dirtyBits.highlightLightStrengthDirty) {
other.q_ptr->setHighlightLightStrength(m_highlightLightStrength);
m_dirtyBits.highlightLightStrengthDirty = false;
- changed = true;
}
if (m_dirtyBits.labelBackgroundColorDirty) {
other.q_ptr->setLabelBackgroundColor(m_textBackgroundColor);
m_dirtyBits.labelBackgroundColorDirty = false;
- changed = true;
+ updateDrawer = true;
}
if (m_dirtyBits.labelBackgroundEnabledDirty) {
other.q_ptr->setLabelBackgroundEnabled(m_labelBackground);
m_dirtyBits.labelBackgroundEnabledDirty = false;
- changed = true;
+ updateDrawer = true;
}
if (m_dirtyBits.labelBorderEnabledDirty) {
other.q_ptr->setLabelBorderEnabled(m_labelBorders);
m_dirtyBits.labelBorderEnabledDirty = false;
- changed = true;
+ updateDrawer = true;
}
if (m_dirtyBits.labelTextColorDirty) {
other.q_ptr->setLabelTextColor(m_textColor);
m_dirtyBits.labelTextColorDirty = false;
- changed = true;
+ updateDrawer = true;
}
if (m_dirtyBits.lightColorDirty) {
other.q_ptr->setLightColor(m_lightColor);
m_dirtyBits.lightColorDirty = false;
- changed = true;
}
if (m_dirtyBits.lightStrengthDirty) {
other.q_ptr->setLightStrength(m_lightStrength);
m_dirtyBits.lightStrengthDirty = false;
- changed = true;
}
if (m_dirtyBits.multiHighlightColorDirty) {
other.q_ptr->setMultiHighlightColor(m_multiHighlightColor);
m_dirtyBits.multiHighlightColorDirty = false;
- changed = true;
}
if (m_dirtyBits.multiHighlightGradientDirty) {
other.q_ptr->setMultiHighlightGradient(m_multiHighlightGradient);
m_dirtyBits.multiHighlightGradientDirty = false;
- changed = true;
}
if (m_dirtyBits.singleHighlightColorDirty) {
other.q_ptr->setSingleHighlightColor(m_singleHighlightColor);
m_dirtyBits.singleHighlightColorDirty = false;
- changed = true;
}
if (m_dirtyBits.singleHighlightGradientDirty) {
other.q_ptr->setSingleHighlightGradient(m_singleHighlightGradient);
m_dirtyBits.singleHighlightGradientDirty = false;
- changed = true;
}
if (m_dirtyBits.themeIdDirty) {
other.m_themeId = m_themeId; // Set directly to avoid a call to ThemeManager's useTheme()
m_dirtyBits.themeIdDirty = false;
- changed = true;
}
if (m_dirtyBits.windowColorDirty) {
other.q_ptr->setWindowColor(m_windowColor);
m_dirtyBits.windowColorDirty = false;
- changed = true;
}
- return changed;
+
+ return updateDrawer;
}
QT_END_NAMESPACE_DATAVISUALIZATION