From ec195a34594dea6145af5e8f2fedc2f9401d0f14 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 19 Jun 2014 09:54:03 +0300 Subject: Polar graph support, phase one - Polar property for toggling the polar mode - Example added. Example docs will be added in another patch once all of the functionality the example needs has been implemented. - Only surface graph supports polar so far. Scatter to be added later. Change-Id: I54d36f764ac1771ac88f73a5f3a2142f2309f6e8 Reviewed-by: Mika Salmela --- tests/surfacetest/graphmodifier.cpp | 5 +++++ tests/surfacetest/graphmodifier.h | 1 + tests/surfacetest/main.cpp | 7 +++++++ 3 files changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/surfacetest/graphmodifier.cpp b/tests/surfacetest/graphmodifier.cpp index ed86f03c..56cd23cc 100644 --- a/tests/surfacetest/graphmodifier.cpp +++ b/tests/surfacetest/graphmodifier.cpp @@ -777,6 +777,11 @@ void GraphModifier::toggleZAscending(bool enabled) } } +void GraphModifier::togglePolar(bool enabled) +{ + m_graph->setPolar(enabled); +} + void GraphModifier::resetArrayAndSliders(QSurfaceDataArray *array, float minZ, float maxZ, float minX, float maxX) { m_axisMinSliderX->setValue(minX); diff --git a/tests/surfacetest/graphmodifier.h b/tests/surfacetest/graphmodifier.h index 5f1a252a..e70d35f2 100644 --- a/tests/surfacetest/graphmodifier.h +++ b/tests/surfacetest/graphmodifier.h @@ -131,6 +131,7 @@ public slots: void toggleAxisTitleFixed(bool enabled); void toggleXAscending(bool enabled); void toggleZAscending(bool enabled); + void togglePolar(bool enabled); private: void fillSeries(); diff --git a/tests/surfacetest/main.cpp b/tests/surfacetest/main.cpp index 5806d7b0..87f009cb 100644 --- a/tests/surfacetest/main.cpp +++ b/tests/surfacetest/main.cpp @@ -393,6 +393,10 @@ int main(int argc, char *argv[]) zAscendingCB->setText(QStringLiteral("Z Ascending")); zAscendingCB->setChecked(true); + QCheckBox *polarCB = new QCheckBox(widget); + polarCB->setText(QStringLiteral("Polar")); + polarCB->setChecked(false); + // Add controls to the layout #ifdef MULTI_SERIES vLayout->addWidget(series1CB); @@ -443,6 +447,7 @@ int main(int argc, char *argv[]) vLayout->addWidget(axisMinSliderZ); vLayout->addWidget(xAscendingCB); vLayout->addWidget(zAscendingCB); + vLayout->addWidget(polarCB); vLayout2->addWidget(new QLabel(QStringLiteral("Change font"))); vLayout2->addWidget(fontList); vLayout2->addWidget(labelButton); @@ -650,6 +655,8 @@ int main(int argc, char *argv[]) modifier, &GraphModifier::toggleXAscending); QObject::connect(zAscendingCB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleZAscending); + QObject::connect(polarCB, &QCheckBox::stateChanged, + modifier, &GraphModifier::togglePolar); QObject::connect(aspectRatioSlider, &QSlider::valueChanged, modifier, &GraphModifier::setAspectRatio); -- cgit v1.2.3