summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-06-05 13:56:59 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-06-06 06:17:56 +0300
commit4f5546e028c346537df65e3f5977ab7922ccedf2 (patch)
treeaf1e34e9d9104c3bf01b65722a610f063f5a1f93 /examples
parent8cd166fe789fa2aa3a40442a31df015f645d32b8 (diff)
Added API for disabling/enabling background
Still to do: new bar objects are needed for disabled background, as current ones do not have bottom (to save in polygon count). Change-Id: I9689fc57314b48b8a6929886d04416bd513ea3dc Change-Id: I9689fc57314b48b8a6929886d04416bd513ea3dc Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/widget/chart.cpp5
-rw-r--r--examples/widget/chart.h1
-rw-r--r--examples/widget/main.cpp7
3 files changed, 13 insertions, 0 deletions
diff --git a/examples/widget/chart.cpp b/examples/widget/chart.cpp
index eecae87e..c57a6752 100644
--- a/examples/widget/chart.cpp
+++ b/examples/widget/chart.cpp
@@ -270,6 +270,11 @@ void ChartModifier::changeShadowQuality(int quality)
m_chart->setShadowQuality(sq);
}
+void ChartModifier::setBackgroundEnabled(int enabled)
+{
+ m_chart->setBackgroundEnabled((bool)enabled);
+}
+
void ChartModifier::setGridEnabled(int enabled)
{
m_chart->setGridEnabled((bool)enabled);
diff --git a/examples/widget/chart.h b/examples/widget/chart.h
index 81b123e5..f4ef747b 100644
--- a/examples/widget/chart.h
+++ b/examples/widget/chart.h
@@ -67,6 +67,7 @@ public:
void changeFontSize(int fontsize);
void rotateX(int rotation);
void rotateY(int rotation);
+ void setBackgroundEnabled(int enabled);
void setGridEnabled(int enabled);
void setSpecsX(int barwidth);
void setSpecsZ(int bardepth);
diff --git a/examples/widget/main.cpp b/examples/widget/main.cpp
index 3824f717..1b33b177 100644
--- a/examples/widget/main.cpp
+++ b/examples/widget/main.cpp
@@ -93,6 +93,10 @@ int main(int argc, char **argv)
QPushButton *selectionButton = new QPushButton(widget);
selectionButton->setText(QStringLiteral("Change selection mode"));
+ QCheckBox *backgroundCheckBox = new QCheckBox(widget);
+ backgroundCheckBox->setText(QStringLiteral("Show background"));
+ backgroundCheckBox->setChecked(true);
+
QCheckBox *gridCheckBox = new QCheckBox(widget);
gridCheckBox->setText(QStringLiteral("Show grid"));
gridCheckBox->setChecked(true);
@@ -186,6 +190,7 @@ int main(int argc, char **argv)
vLayout->addWidget(styleButton, 0, Qt::AlignTop);
vLayout->addWidget(cameraButton, 0, Qt::AlignTop);
vLayout->addWidget(selectionButton, 0, Qt::AlignTop);
+ vLayout->addWidget(backgroundCheckBox);
vLayout->addWidget(gridCheckBox);
vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality")));
vLayout->addWidget(shadowQuality);
@@ -234,6 +239,8 @@ int main(int argc, char **argv)
QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier,
&ChartModifier::changeFont);
+ QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, modifier,
+ &ChartModifier::setBackgroundEnabled);
QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier,
&ChartModifier::setGridEnabled);