Fix examples and manual tests for background toggling

The naming of window/background/plotAreaBackground
created a couple of wrong behaviors in the examples.

Change-Id: I9932962e2567823ec72178ab2f5d4a70251ea299
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Kwanghyo Park <kwanghyo.park@qt.io>
This commit is contained in:
Tomi Korpipaa 2024-05-13 12:39:59 +03:00
parent d3ef41c92c
commit 3520a9eea7
7 changed files with 13 additions and 13 deletions

View File

@ -138,8 +138,8 @@ Item {
source: graph.theme.backgroundEnabled ?
"qrc:/images/background_hide.svg" : "qrc:/images/background.svg"
onClicked: {
graph.theme.backgroundEnabled = !graph.theme.backgroundEnabled
text = graph.theme.backgroundEnabled ? qsTr("Hide Background") : qsTr("Show Background")
graph.theme.plotAreaBackgroundEnabled = !graph.theme.plotAreaBackgroundEnabled
text = graph.theme.plotAreaBackgroundEnabled ? qsTr("Hide Graph Background") : qsTr("Show Graph Background")
}
}
}
@ -162,7 +162,7 @@ Item {
source: "qrc:/images/theme.svg"
onClicked: {
graph.theme = graph.theme.theme === GraphsTheme.Theme.QtGreenNeon ? themeQt : themeQtNeonGreen
backgroundButton.text = graph.theme.backgroundEnabled ? qsTr("Hide Background") : qsTr("Show Background")
backgroundButton.text = graph.theme.plotAreaBackgroundEnabled ? qsTr("Hide Graph Background") : qsTr("Show Graph Background")
}
}
}

View File

@ -118,7 +118,7 @@ void BarGraph::initialize()
selectionModeList->setCurrentIndex(1);
auto *backgroundCheckBox = new QCheckBox(m_barsWidget);
backgroundCheckBox->setText(u"Show background"_s);
backgroundCheckBox->setText(u"Show graph background"_s);
backgroundCheckBox->setChecked(false);
auto *gridCheckBox = new QCheckBox(m_barsWidget);

View File

@ -34,7 +34,7 @@ GraphModifier::GraphModifier(Q3DBars *bargraph, QObject *parent)
{
//! [2]
m_graph->setShadowQuality(QAbstract3DGraph::ShadowQuality::SoftMedium);
m_graph->activeTheme()->setBackgroundEnabled(false);
m_graph->activeTheme()->setPlotAreaBackgroundEnabled(false);
m_graph->activeTheme()->setLabelFont(QFont("Times New Roman", m_fontSize));
m_graph->activeTheme()->setLabelBackgroundEnabled(true);
m_graph->setMultiSeriesUniform(true);
@ -240,7 +240,7 @@ void GraphModifier::changeTheme(int theme)
{
QGraphsTheme *currentTheme = m_graph->activeTheme();
currentTheme->setTheme(QGraphsTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit backgroundEnabledChanged(currentTheme->isPlotAreaBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
emit fontChanged(currentTheme->labelFont());
emit fontSizeChanged(currentTheme->labelFont().pointSize());
@ -404,7 +404,7 @@ void GraphModifier::rotateY(int rotation)
void GraphModifier::setBackgroundEnabled(int enabled)
{
m_graph->activeTheme()->setBackgroundEnabled(bool(enabled));
m_graph->activeTheme()->setPlotAreaBackgroundEnabled(bool(enabled));
}
void GraphModifier::setGridEnabled(int enabled)

View File

@ -117,7 +117,7 @@ void ScatterDataModifier::changeTheme(int theme)
{
QGraphsTheme *currentTheme = m_graph->activeTheme();
currentTheme->setTheme(QGraphsTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit backgroundEnabledChanged(currentTheme->isPlotAreaBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
}
@ -217,7 +217,7 @@ void ScatterDataModifier::changeShadowQuality(int quality)
void ScatterDataModifier::setBackgroundEnabled(int enabled)
{
m_graph->activeTheme()->setBackgroundEnabled((bool) enabled);
m_graph->activeTheme()->setPlotAreaBackgroundEnabled((bool) enabled);
}
void ScatterDataModifier::setGridEnabled(int enabled)

View File

@ -59,7 +59,7 @@ void ScatterGraph::initialize()
rangeMaxSlider->setValue(10);
auto *backgroundCheckBox = new QCheckBox(m_scatterWidget);
backgroundCheckBox->setText(u"Show background"_s);
backgroundCheckBox->setText(u"Show graph background"_s);
backgroundCheckBox->setChecked(true);
auto *gridCheckBox = new QCheckBox(m_scatterWidget);

View File

@ -39,7 +39,7 @@ VolumetricModifier::VolumetricModifier(Q3DScatter *scatter)
//! [0]
m_graph->setOrthoProjection(true);
//! [0]
m_graph->activeTheme()->setBackgroundEnabled(false);
m_graph->activeTheme()->setPlotAreaBackgroundEnabled(false);
// Only allow zooming at the center and limit the zoom to 200% to avoid clipping issues
m_graph->setZoomAtTargetEnabled(false);

View File

@ -125,7 +125,7 @@ void ScatterDataModifier::changeTheme(int theme)
{
QGraphsTheme *currentTheme = m_graph->activeTheme();
currentTheme->setTheme(QGraphsTheme::Theme(theme));
emit backgroundEnabledChanged(currentTheme->isBackgroundEnabled());
emit backgroundEnabledChanged(currentTheme->isPlotAreaBackgroundEnabled());
emit gridEnabledChanged(currentTheme->isGridEnabled());
emit fontChanged(currentTheme->labelFont());
}
@ -184,7 +184,7 @@ void ScatterDataModifier::changeShadowQuality(int quality)
void ScatterDataModifier::setBackgroundEnabled(int enabled)
{
m_graph->activeTheme()->setBackgroundEnabled((bool)enabled);
m_graph->activeTheme()->setPlotAreaBackgroundEnabled((bool) enabled);
}
void ScatterDataModifier::setGridEnabled(int enabled)