diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-03-12 09:54:10 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-03-12 09:54:10 +0200 |
commit | e4155708608a605e44c46af23cc38fa04a1128dc (patch) | |
tree | e6ef1d0ee450b814a176e3e0d86baaf6387ea2e4 /examples/datavis3d/spectrum/spectrumapp/main.cpp | |
parent | 1a008562a663933aa242867fdf86f8de80b43042 (diff) |
Added a separate shader for background
Added api call for setting color scheme
Added api call to set whole data set at once
Diffstat (limited to 'examples/datavis3d/spectrum/spectrumapp/main.cpp')
-rw-r--r-- | examples/datavis3d/spectrum/spectrumapp/main.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/datavis3d/spectrum/spectrumapp/main.cpp b/examples/datavis3d/spectrum/spectrumapp/main.cpp index ad60c5ff..bc438e3e 100644 --- a/examples/datavis3d/spectrum/spectrumapp/main.cpp +++ b/examples/datavis3d/spectrum/spectrumapp/main.cpp @@ -85,9 +85,16 @@ MainApp::MainApp(Q3DBars *window) , m_highFreq(SpectrumHighFreq) { m_chart->setupSampleSpace(QPoint(SpectrumNumBands, SpectrumNumBands*3)); - m_chart->setBarSpecs(QPointF(1.0f, 0.75f), QPointF(0.2f, -0.5f)); + // Set bar specifications; make them a bit wider than deep and make them be drawn 75% + // inside each other + m_chart->setBarSpecs(QPointF(1.0f, 0.75f), QPointF(0.2f, -0.75f)); + // Set bar type, smooth cones m_chart->setBarType(Q3DBars::Cones, true); - m_chart->setCameraPosition(10.0f, 5.0f, 90); + // Adjust zoom manually; automatic zoom level calculation does not work well with negative + // spacings (in setBarSpecs) + m_chart->setCameraPosition(10.0f, 5.0f, 70); + // Set color scheme + m_chart->setBarColor(QColor(Qt::black), QColor(Qt::red), QColor(Qt::darkYellow)); QObject::connect(m_engine, &Engine::changedSpectrum, this, &MainApp::spectrumChanged); QObject::connect(m_engine, &Engine::stateChanged, this, &MainApp::stateChanged); m_restartTimer->setSingleShot(true); @@ -130,7 +137,7 @@ void MainApp::spectrumChanged(qint64 position, qint64 length, const FrequencySpe } } if (data.size() > 0) - m_chart->addDataSet(data); + m_chart->addDataRow(data); } void MainApp::stateChanged(QAudio::Mode mode, QAudio::State state) |