diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/barstest/chart.cpp | 24 | ||||
-rw-r--r-- | tests/multigraphs/data.cpp | 8 | ||||
-rw-r--r-- | tests/qmlcamera/qml/qmlcamera/main.qml | 8 | ||||
-rw-r--r-- | tests/scattertest/scatterchart.cpp | 23 | ||||
-rw-r--r-- | tests/spectrum/spectrumapp/main.cpp | 3 | ||||
-rw-r--r-- | tests/surfacetest/graphmodifier.cpp | 9 |
6 files changed, 33 insertions, 42 deletions
diff --git a/tests/barstest/chart.cpp b/tests/barstest/chart.cpp index 46bc0be1..546204ce 100644 --- a/tests/barstest/chart.cpp +++ b/tests/barstest/chart.cpp @@ -119,7 +119,7 @@ GraphModifier::GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog) m_genericData->setItemLabelFormat(QStringLiteral("3: @valueTitle for (@rowIdx, @colIdx): @valueLabel")); m_genericData->dataProxy()->setColumnLabels(genericColumnLabels); - m_graph->setFont(QFont("Times Roman", 20)); + m_graph->theme()->setFont(QFont("Times Roman", 20)); // Release and store the default input handler. m_defaultInputHandler = m_graph->activeInputHandler(); @@ -523,12 +523,7 @@ void GraphModifier::changeTheme() void GraphModifier::changeLabelStyle() { - static int style = QDataVis::LabelStyleOpaque; - - m_graph->setLabelStyle((QDataVis::LabelStyle)style); - - if (++style > QDataVis::LabelStyleTransparent) - style = QDataVis::LabelStyleOpaque; + m_graph->theme()->setLabelBackgroundEnabled(!m_graph->theme()->isLabelBackgroundEnabled()); } void GraphModifier::changeSelectionMode() @@ -545,15 +540,15 @@ void GraphModifier::changeFont(const QFont &font) { QFont newFont = font; newFont.setPointSize(m_fontSize); - m_graph->setFont(newFont); + m_graph->theme()->setFont(newFont); } void GraphModifier::changeFontSize(int fontsize) { m_fontSize = fontsize; - QFont font = m_graph->font(); + QFont font = m_graph->theme()->font(); font.setPointSize(m_fontSize); - m_graph->setFont(font); + m_graph->theme()->setFont(font); } void GraphModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq) @@ -600,12 +595,12 @@ void GraphModifier::changeShadowQuality(int quality) void GraphModifier::setBackgroundEnabled(int enabled) { - m_graph->setBackgroundVisible((bool)enabled); + m_graph->theme()->setBackgroundEnabled(bool(enabled)); } void GraphModifier::setGridEnabled(int enabled) { - m_graph->setGridVisible((bool)enabled); + m_graph->theme()->setGridEnabled(bool(enabled)); } void GraphModifier::rotateX(int rotation) @@ -685,13 +680,16 @@ void GraphModifier::changeColorStyle() void GraphModifier::useOwnTheme() { Q3DTheme *theme = new Q3DTheme(); + theme->setBackgroundEnabled(true); + theme->setGridEnabled(true); theme->setAmbientLightStrength(0.3f); theme->setBackgroundColor(QColor(QRgb(0x99ca53))); theme->setBaseColor(QColor(QRgb(0x209fdf))); theme->setColorStyle(QDataVis::ColorStyleUniform); theme->setGridLineColor(QColor(QRgb(0x99ca53))); theme->setHighlightLightStrength(7.0f); - theme->setLabelBorderEnabled(false); + theme->setLabelBackgroundEnabled(true); + theme->setLabelBorderEnabled(true); theme->setLightColor(Qt::white); theme->setLightStrength(6.0f); theme->setMultiHighlightColor(QColor(QRgb(0x6d5fd5))); diff --git a/tests/multigraphs/data.cpp b/tests/multigraphs/data.cpp index dc4fcaec..d2fe1051 100644 --- a/tests/multigraphs/data.cpp +++ b/tests/multigraphs/data.cpp @@ -52,10 +52,10 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, gradient.setColorAt(0.67, Qt::red); gradient.setColorAt(1.0, Qt::yellow); m_surface->setSelectionMode(QDataVis::SelectionNone); - m_surface->setGridVisible(false); + m_surface->theme()->setGridEnabled(false); m_surface->setGradient(gradient); m_surface->setSurfaceGridEnabled(false); - m_surface->setBackgroundVisible(false); + m_surface->theme()->setBackgroundEnabled(false); m_surface->setSmoothSurfaceEnabled(false); m_surface->scene()->activeCamera()->setCameraPosition(0.0, 90.0, 150); m_surface->addSeries(new QSurface3DSeries(new QHeightMapSurfaceDataProxy())); @@ -63,7 +63,7 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, // Initialize scatter m_scatter->setTheme(new Q3DTheme(QDataVis::ThemeStoneMoss)); m_scatter->setSelectionMode(QDataVis::SelectionNone); - m_scatter->setGridVisible(false); + m_scatter->theme()->setGridEnabled(false); m_scatter->setObjectType(QDataVis::MeshStylePoints); m_scatter->setShadowQuality(QDataVis::ShadowQualitySoftLow); m_scatter->scene()->activeCamera()->setCameraPosition(0.0, 85.0, 150); @@ -72,7 +72,7 @@ Data::Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, // Initialize bars m_bars->setTheme(new Q3DTheme(QDataVis::ThemeQt)); m_bars->setSelectionMode(QDataVis::SelectionItemAndRow | QDataVis::SelectionSlice); - m_bars->setGridVisible(false); + m_bars->theme()->setGridEnabled(false); m_bars->setBarType(QDataVis::MeshStyleBars, false); m_bars->setShadowQuality(QDataVis::ShadowQualityLow); m_bars->setBarSpacing(QSizeF(0.0, 0.0)); diff --git a/tests/qmlcamera/qml/qmlcamera/main.qml b/tests/qmlcamera/qml/qmlcamera/main.qml index aad60f42..8358a369 100644 --- a/tests/qmlcamera/qml/qmlcamera/main.qml +++ b/tests/qmlcamera/qml/qmlcamera/main.qml @@ -47,9 +47,11 @@ Item { height: dataView.height shadowQuality: Bars3D.ShadowQualityMedium selectionMode: Bars3D.SelectionItem - font.pointSize: 35 - theme: Theme3D { type: Bars3D.ThemeRetro } - labelStyle: Bars3D.LabelStyleFromTheme + theme: Theme3D { + type: Bars3D.ThemeRetro + font.pointSize: 35 + labelBackgroundEnabled: true + } seriesList: [chartData.series] barThickness: 0.5 barSpacing: Qt.size(0.5, 0.5) diff --git a/tests/scattertest/scatterchart.cpp b/tests/scattertest/scatterchart.cpp index d0615193..5f43b486 100644 --- a/tests/scattertest/scatterchart.cpp +++ b/tests/scattertest/scatterchart.cpp @@ -37,11 +37,11 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter) m_selectedItem(-1), m_targetSeries(0) { - QFont font = m_chart->font(); + m_chart->setTheme(new Q3DTheme(QDataVis::ThemeStoneMoss)); + QFont font = m_chart->theme()->font(); font.setPointSize(m_fontSize); - m_chart->setFont(font); + m_chart->theme()->setFont(font); m_chart->setObjectType(QDataVis::MeshStyleSpheres, true); - m_chart->setTheme(new Q3DTheme(QDataVis::ThemeStoneMoss)); m_chart->setShadowQuality(QDataVis::ShadowQualityNone); m_chart->scene()->activeCamera()->setCameraPreset(QDataVis::CameraPresetFront); m_chart->setAxisX(new Q3DValueAxis); @@ -155,27 +155,22 @@ void ScatterDataModifier::changeTheme() void ScatterDataModifier::changeLabelStyle() { - static int style = QDataVis::LabelStyleOpaque; - - m_chart->setLabelStyle((QDataVis::LabelStyle)style); - - if (++style > QDataVis::LabelStyleTransparent) - style = QDataVis::LabelStyleOpaque; + m_chart->theme()->setLabelBackgroundEnabled(!m_chart->theme()->isLabelBackgroundEnabled()); } void ScatterDataModifier::changeFont(const QFont &font) { QFont newFont = font; newFont.setPointSizeF(m_fontSize); - m_chart->setFont(newFont); + m_chart->theme()->setFont(newFont); } void ScatterDataModifier::changeFontSize(int fontsize) { m_fontSize = fontsize; - QFont font = m_chart->font(); + QFont font = m_chart->theme()->font(); font.setPointSize(m_fontSize); - m_chart->setFont(font); + m_chart->theme()->setFont(font); } void ScatterDataModifier::shadowQualityUpdatedByVisual(QDataVis::ShadowQuality sq) @@ -456,12 +451,12 @@ void ScatterDataModifier::changeShadowQuality(int quality) void ScatterDataModifier::setBackgroundEnabled(int enabled) { - m_chart->setBackgroundVisible((bool)enabled); + m_chart->theme()->setBackgroundEnabled((bool)enabled); } void ScatterDataModifier::setGridEnabled(int enabled) { - m_chart->setGridVisible((bool)enabled); + m_chart->theme()->setGridEnabled((bool)enabled); } QVector3D ScatterDataModifier::randVector() diff --git a/tests/spectrum/spectrumapp/main.cpp b/tests/spectrum/spectrumapp/main.cpp index 8b18e467..7277d752 100644 --- a/tests/spectrum/spectrumapp/main.cpp +++ b/tests/spectrum/spectrumapp/main.cpp @@ -26,6 +26,7 @@ #include <QtDataVisualization/q3dscene.h> #include <QtDataVisualization/q3dcamera.h> #include <QtDataVisualization/qbar3dseries.h> +#include <QtDataVisualization/q3dtheme.h> #include <QGuiApplication> #include <QAudio> @@ -73,7 +74,7 @@ MainApp::MainApp(Q3DBars *window) m_chart->rowAxis()->setMax(SpectrumNumBands * 2); m_chart->columnAxis()->setMax(SpectrumNumBands - 1); // Disable grid - m_chart->setGridVisible(false); + m_chart->theme()->setGridEnabled(false); // Disable auto-scaling of height by defining explicit range m_chart->valueAxis()->setRange(0.0f, 1.0f); // Disable shadows diff --git a/tests/surfacetest/graphmodifier.cpp b/tests/surfacetest/graphmodifier.cpp index 1ee4f56b..38ad4971 100644 --- a/tests/surfacetest/graphmodifier.cpp +++ b/tests/surfacetest/graphmodifier.cpp @@ -317,17 +317,12 @@ void GraphModifier::changeFont(const QFont &font) { QFont newFont = font; newFont.setPointSizeF(m_fontSize); - m_graph->setFont(newFont); + m_graph->theme()->setFont(newFont); } void GraphModifier::changeStyle() { - static int style = QDataVis::LabelStyleFromTheme; - - m_graph->setLabelStyle((QDataVis::LabelStyle)style); - - if (++style > QDataVis::LabelStyleTransparent) - style = QDataVis::LabelStyleOpaque; + m_graph->theme()->setLabelBackgroundEnabled(!m_graph->theme()->isLabelBackgroundEnabled()); } void GraphModifier::selectButtonClicked() |