summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/audiolevels/audiolevels.cpp2
-rw-r--r--examples/bars/graphmodifier.cpp5
-rw-r--r--examples/custominput/scatterdatamodifier.cpp2
-rw-r--r--examples/customproxy/rainfallgraph.cpp2
-rw-r--r--examples/itemmodel/main.cpp2
-rw-r--r--examples/qmlscatter/qml/qmlscatter/main.qml7
-rw-r--r--examples/scatter/scatterdatamodifier.cpp7
-rw-r--r--examples/surface/doc/src/surface.qdoc3
-rw-r--r--examples/surface/surfacegraph.cpp5
9 files changed, 16 insertions, 19 deletions
diff --git a/examples/audiolevels/audiolevels.cpp b/examples/audiolevels/audiolevels.cpp
index 259274d9..33a0be3b 100644
--- a/examples/audiolevels/audiolevels.cpp
+++ b/examples/audiolevels/audiolevels.cpp
@@ -46,7 +46,7 @@ AudioLevels::AudioLevels(Q3DBars *graph, QObject *parent)
m_graph->setShadowQuality(QDataVis::ShadowQualityNone);
m_graph->setSelectionMode(QDataVis::SelectionNone);
m_graph->scene()->activeCamera()->setCameraPosition(-25.0f, 10.0f, 190.0f);
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeIsabelle);
m_graph->activeTheme()->setGridEnabled(true);
m_graph->activeTheme()->setBackgroundEnabled(false);
QFont font = m_graph->activeTheme()->font();
diff --git a/examples/bars/graphmodifier.cpp b/examples/bars/graphmodifier.cpp
index 09fec65d..fddc385e 100644
--- a/examples/bars/graphmodifier.cpp
+++ b/examples/bars/graphmodifier.cpp
@@ -186,10 +186,7 @@ void GraphModifier::changePresetCamera()
void GraphModifier::changeTheme(int theme)
{
Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- currentTheme = new Q3DTheme(Q3DTheme::Theme(theme));
- m_graph->setActiveTheme(currentTheme);
+ currentTheme->setType(Q3DTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
emit fontChanged(currentTheme->font());
diff --git a/examples/custominput/scatterdatamodifier.cpp b/examples/custominput/scatterdatamodifier.cpp
index aeef4c98..acdf3e8d 100644
--- a/examples/custominput/scatterdatamodifier.cpp
+++ b/examples/custominput/scatterdatamodifier.cpp
@@ -32,7 +32,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
: m_graph(scatter),
m_inputHandler(new CustomInputHandler())
{
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeDigia));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeDigia);
m_graph->setShadowQuality(QDataVis::ShadowQualityMedium);
m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetFront);
diff --git a/examples/customproxy/rainfallgraph.cpp b/examples/customproxy/rainfallgraph.cpp
index 57e1d0ea..0fd91419 100644
--- a/examples/customproxy/rainfallgraph.cpp
+++ b/examples/customproxy/rainfallgraph.cpp
@@ -72,7 +72,7 @@ RainfallGraph::RainfallGraph(Q3DBars *rainfall)
m_graph->setSelectionMode(QDataVis::SelectionItemAndColumn | QDataVis::SelectionSlice);
// Set theme
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeArmyBlue));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeArmyBlue);
// Set font to theme
m_graph->activeTheme()->setFont(QFont("Century Gothic", 30));
diff --git a/examples/itemmodel/main.cpp b/examples/itemmodel/main.cpp
index 015470d1..8cec91ba 100644
--- a/examples/itemmodel/main.cpp
+++ b/examples/itemmodel/main.cpp
@@ -107,7 +107,7 @@ GraphDataGenerator::GraphDataGenerator(Q3DBars *bargraph, QTableWidget *tableWid
//! [7]
// Set theme
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeDigia));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeDigia);
// Set font
m_graph->activeTheme()->setFont(QFont("Impact", 20));
diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml
index 50164c50..b3ea5f07 100644
--- a/examples/qmlscatter/qml/qmlscatter/main.qml
+++ b/examples/qmlscatter/qml/qmlscatter/main.qml
@@ -44,7 +44,7 @@ Item {
//! [13]
Theme3D {
- id : themeArmyBlue
+ id: themeArmyBlue
type: Theme3D.ThemeArmyBlue
}
@@ -194,6 +194,11 @@ Item {
} else {
scatterGraph.theme = themeArmyBlue
}
+ if (scatterGraph.theme.backgroundEnabled === true) {
+ backgroundToggle.text = "Hide Background";
+ } else {
+ backgroundToggle.text = "Show Background";
+ }
}
}
diff --git a/examples/scatter/scatterdatamodifier.cpp b/examples/scatter/scatterdatamodifier.cpp
index 964da977..ade34da4 100644
--- a/examples/scatter/scatterdatamodifier.cpp
+++ b/examples/scatter/scatterdatamodifier.cpp
@@ -39,7 +39,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
m_smooth(true)
{
//! [0]
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::ThemeEbony));
+ m_graph->activeTheme()->setType(Q3DTheme::ThemeEbony);
QFont font = m_graph->activeTheme()->font();
font.setPointSize(m_fontSize);
m_graph->activeTheme()->setFont(font);
@@ -132,10 +132,7 @@ void ScatterDataModifier::setSmoothDots(int smooth)
void ScatterDataModifier::changeTheme(int theme)
{
Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- currentTheme = new Q3DTheme(Q3DTheme::Theme(theme));
- m_graph->setActiveTheme(currentTheme);
+ currentTheme->setType(Q3DTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
emit fontChanged(currentTheme->font());
diff --git a/examples/surface/doc/src/surface.qdoc b/examples/surface/doc/src/surface.qdoc
index dd334d01..d34c075e 100644
--- a/examples/surface/doc/src/surface.qdoc
+++ b/examples/surface/doc/src/surface.qdoc
@@ -124,7 +124,8 @@
Q3DSurface supports all the themes Qt Data Visualization has. The example has a pull
down menu for selecting the theme. The following method is connected to the
- menu to activate the selected theme. The old theme is released and deleted:
+ menu to activate the selected theme. The theme type is changed to another predefined theme,
+ which overwrites all theme properties to predefined values:
\snippet ../examples/surface/surfacegraph.cpp 6
diff --git a/examples/surface/surfacegraph.cpp b/examples/surface/surfacegraph.cpp
index 3770906e..a3d2b60e 100644
--- a/examples/surface/surfacegraph.cpp
+++ b/examples/surface/surfacegraph.cpp
@@ -229,10 +229,7 @@ void SurfaceGraph::setAxisZRange(float min, float max)
//! [6]
void SurfaceGraph::changeTheme(int theme)
{
- Q3DTheme *currentTheme = m_graph->activeTheme();
- m_graph->releaseTheme(currentTheme);
- delete currentTheme;
- m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(theme)));
+ m_graph->activeTheme()->setType(Q3DTheme::Theme(theme));
}
//! [6]