diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-12-20 10:56:59 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-01-07 08:10:13 +0200 |
commit | aa842c39480aa5b95f704c97b8b3acc821144883 (patch) | |
tree | 8a1e90e1fe1d6d85054286e655cb2e1722d758eb /examples/surface | |
parent | 91a94a743b4cfd30ef77aa73837050d44620469b (diff) |
Fix theme ownership
Theme ownership now uses similar model as axis and inputhandler
ownership: Graph can own multiple themes, but only one is active
at the time.
Task-number: QTRD-2623
Change-Id: I7134384df6f8cc465cc28fbebb454b7d2e254f83
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples/surface')
-rw-r--r-- | examples/surface/doc/src/surface.qdoc | 2 | ||||
-rw-r--r-- | examples/surface/surfacegraph.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/examples/surface/doc/src/surface.qdoc b/examples/surface/doc/src/surface.qdoc index 6f49a3dc..dd334d01 100644 --- a/examples/surface/doc/src/surface.qdoc +++ b/examples/surface/doc/src/surface.qdoc @@ -124,7 +124,7 @@ 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. + menu to activate the selected theme. The old theme is released and deleted: \snippet ../examples/surface/surfacegraph.cpp 6 diff --git a/examples/surface/surfacegraph.cpp b/examples/surface/surfacegraph.cpp index 7ebb6b72..3770906e 100644 --- a/examples/surface/surfacegraph.cpp +++ b/examples/surface/surfacegraph.cpp @@ -229,7 +229,10 @@ void SurfaceGraph::setAxisZRange(float min, float max) //! [6] void SurfaceGraph::changeTheme(int theme) { - m_graph->setTheme(new Q3DTheme(Q3DTheme::Theme(theme))); + Q3DTheme *currentTheme = m_graph->activeTheme(); + m_graph->releaseTheme(currentTheme); + delete currentTheme; + m_graph->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(theme))); } //! [6] |