summaryrefslogtreecommitdiffstats
path: root/tests/surfacetest
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2013-12-20 10:56:59 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-01-07 08:10:13 +0200
commitaa842c39480aa5b95f704c97b8b3acc821144883 (patch)
tree8a1e90e1fe1d6d85054286e655cb2e1722d758eb /tests/surfacetest
parent91a94a743b4cfd30ef77aa73837050d44620469b (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 'tests/surfacetest')
-rw-r--r--tests/surfacetest/graphmodifier.cpp9
-rw-r--r--tests/surfacetest/main.cpp2
2 files changed, 7 insertions, 4 deletions
diff --git a/tests/surfacetest/graphmodifier.cpp b/tests/surfacetest/graphmodifier.cpp
index 3474b67f..749b1c69 100644
--- a/tests/surfacetest/graphmodifier.cpp
+++ b/tests/surfacetest/graphmodifier.cpp
@@ -338,12 +338,12 @@ void GraphModifier::changeFont(const QFont &font)
{
QFont newFont = font;
newFont.setPointSizeF(m_fontSize);
- m_graph->theme()->setFont(newFont);
+ m_graph->activeTheme()->setFont(newFont);
}
void GraphModifier::changeStyle()
{
- m_graph->theme()->setLabelBackgroundEnabled(!m_graph->theme()->isLabelBackgroundEnabled());
+ m_graph->activeTheme()->setLabelBackgroundEnabled(!m_graph->activeTheme()->isLabelBackgroundEnabled());
}
void GraphModifier::selectButtonClicked()
@@ -363,7 +363,10 @@ void GraphModifier::selectedPointChanged(const QPoint &point)
void GraphModifier::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)));
}
diff --git a/tests/surfacetest/main.cpp b/tests/surfacetest/main.cpp
index c25c5b89..5a26c7ce 100644
--- a/tests/surfacetest/main.cpp
+++ b/tests/surfacetest/main.cpp
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
QSize screenSize = surfaceGraph->screen()->size();
// Set to default, should be same as the initial on themeList
- surfaceGraph->setTheme(new Q3DTheme(Q3DTheme::Theme(initialTheme)));
+ surfaceGraph->setActiveTheme(new Q3DTheme(Q3DTheme::Theme(initialTheme)));
QWidget *container = QWidget::createWindowContainer(surfaceGraph);
container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 2));