diff options
author | Mika Salmela <mika.salmela@digia.com> | 2013-12-18 11:50:03 +0200 |
---|---|---|
committer | Mika Salmela <mika.salmela@digia.com> | 2013-12-18 11:51:20 +0200 |
commit | 07aba602fc82ac31684988f8e8e22521d2b3c982 (patch) | |
tree | 7ae1da139e8661bf157f996fe71844031d2995f4 /examples/customproxy | |
parent | cf0cf6ca67aec8ae480bb705443ea17f5ab9f9e2 (diff) | |
parent | ea0442bc81ae034d22c5742b6075dee993fdd54d (diff) |
Merge branch 'develop' into mergebranch
Conflicts:
examples/qmlbars/qml/qmlbars/main.qml
examples/qmlscatter/qml/qmlscatter/main.qml
examples/qmlsurface/qml/qmlsurface/main.qml
src/datavisualization/data/qitemmodelbardatamapping.cpp
src/datavisualization/data/qitemmodelscatterdatamapping.cpp
src/datavisualization/data/qitemmodelsurfacedatamapping.cpp
src/datavisualization/engine/drawer.cpp
Change-Id: I731ebdb2cc5cee8f2cb32becee96d1fc1b3e5de1
Diffstat (limited to 'examples/customproxy')
-rw-r--r-- | examples/customproxy/doc/src/customproxy.qdoc | 6 | ||||
-rw-r--r-- | examples/customproxy/main.cpp | 1 | ||||
-rw-r--r-- | examples/customproxy/rainfallgraph.cpp | 25 | ||||
-rw-r--r-- | examples/customproxy/variantbardataproxy.cpp | 2 |
4 files changed, 19 insertions, 15 deletions
diff --git a/examples/customproxy/doc/src/customproxy.qdoc b/examples/customproxy/doc/src/customproxy.qdoc index be2e2a96..dacedb80 100644 --- a/examples/customproxy/doc/src/customproxy.qdoc +++ b/examples/customproxy/doc/src/customproxy.qdoc @@ -37,7 +37,7 @@ of rainfall in that month. The custom proxy we provide here is similar to item model based proxies provided by Qt - Data Visualization in that it requires a mapping object to interpret the data. + Data Visualization in that it requires a mapping to interpret the data. Let's take a closer look at the custom classes: @@ -96,8 +96,8 @@ The primary way to use a \c VariantBarDataMapping object is to give the mappings already at the constructor, though they can be set later individually or all together with the \c remap() method. - A signal is emitted if mapping changes. It is basically a simplified version of - QItemModelBarDataMapping adapted to work with variant lists instead of item models. + A signal is emitted if mapping changes. It is basically a simplified version of the mapping + functionality of QItemModelBarDataProxy adapted to work with variant lists instead of item models. \section1 RainfallGraph diff --git a/examples/customproxy/main.cpp b/examples/customproxy/main.cpp index 54ea63e9..58b43873 100644 --- a/examples/customproxy/main.cpp +++ b/examples/customproxy/main.cpp @@ -26,6 +26,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); Q3DBars *rainfall = new Q3DBars; + rainfall->setFlags(rainfall->flags() ^ Qt::FramelessWindowHint); rainfall->resize(1280, 800); rainfall->setPosition(QPoint(10, 30)); rainfall->show(); diff --git a/examples/customproxy/rainfallgraph.cpp b/examples/customproxy/rainfallgraph.cpp index 3a9f820a..ad45d016 100644 --- a/examples/customproxy/rainfallgraph.cpp +++ b/examples/customproxy/rainfallgraph.cpp @@ -21,6 +21,8 @@ #include <QtDataVisualization/q3dvalueaxis.h> #include <QtDataVisualization/q3dscene.h> #include <QtDataVisualization/q3dcamera.h> +#include <QtDataVisualization/qbar3dseries.h> +#include <QtDataVisualization/q3dtheme.h> #include <QGuiApplication> #include <QFont> #include <QDebug> @@ -39,13 +41,14 @@ RainfallGraph::RainfallGraph(Q3DBars *rainfall) m_columnCount = m_numericMonths.size(); m_proxy = new VariantBarDataProxy; - m_graph->setActiveDataProxy(m_proxy); + QBar3DSeries *series = new QBar3DSeries(m_proxy); + m_graph->addSeries(series); updateYearsList(2000, 2012); // Set up bar specifications; make the bars as wide as they are deep, // and add a small space between the bars - m_graph->setBarThickness(1.0); + m_graph->setBarThickness(1.0f); m_graph->setBarSpacing(QSizeF(0.2, 0.2)); // Set axis labels and titles @@ -56,26 +59,26 @@ RainfallGraph::RainfallGraph(Q3DBars *rainfall) m_graph->valueAxis()->setTitle("rainfall"); m_graph->valueAxis()->setLabelFormat("%d mm"); m_graph->valueAxis()->setSegmentCount(5); - m_graph->rowAxis()->setCategoryLabels(m_years); - m_graph->columnAxis()->setCategoryLabels(months); + m_graph->rowAxis()->setLabels(m_years); + m_graph->columnAxis()->setLabels(months); // Set bar type to cylinder - m_graph->setBarType(QDataVis::MeshStyleCylinders, false); + series->setMesh(QAbstract3DSeries::MeshCylinder); // Set shadows to medium m_graph->setShadowQuality(QDataVis::ShadowQualityMedium); - // Set font - m_graph->setFont(QFont("Century Gothic", 30)); - // Set selection mode to bar and column - m_graph->setSelectionMode(QDataVis::SelectionModeSliceColumn); + m_graph->setSelectionMode(QDataVis::SelectionItemAndColumn | QDataVis::SelectionSlice); // Set theme - m_graph->setTheme(QDataVis::ThemeArmyBlue); + m_graph->setTheme(new Q3DTheme(Q3DTheme::ThemeArmyBlue)); + + // Set font to theme + m_graph->theme()->setFont(QFont("Century Gothic", 30)); // Set camera position and zoom - m_graph->scene()->activeCamera()->setCameraPreset(QDataVis::CameraPresetIsometricRightHigh); + m_graph->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPresetIsometricRightHigh); m_graph->scene()->activeCamera()->setZoomLevel(75); // Set window title diff --git a/examples/customproxy/variantbardataproxy.cpp b/examples/customproxy/variantbardataproxy.cpp index 887115b8..2997810f 100644 --- a/examples/customproxy/variantbardataproxy.cpp +++ b/examples/customproxy/variantbardataproxy.cpp @@ -118,7 +118,7 @@ void VariantBarDataProxy::resolveDataSet() const QStringList &columnList = m_mapping->columnCategories(); // Sort values into rows and columns - typedef QHash<QString, qreal> ColumnValueMap; + typedef QHash<QString, float> ColumnValueMap; QHash <QString, ColumnValueMap> itemValueMap; foreach (const VariantDataItem *item, itemList) { itemValueMap[item->at(rowIndex).toString()][item->at(columnIndex).toString()] |