diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-01-27 13:10:44 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-01-27 13:13:58 +0200 |
commit | b368e57e59351736f9ad06834a743a7c1b49d368 (patch) | |
tree | 3b7d42569905d8cde0ca7571cd664428354a50dd /examples/qmlscatter | |
parent | eb3d0514ca886db33776522ea00f27b69bc86ad1 (diff) | |
parent | 05d06fbc61f07e400b519a9b020c2473398627c1 (diff) |
Merge branch 'develop'v1.0.0-beta1
Change-Id: I1c9a255eb8f30a24b665856d3711f0abe77c6ef4
Diffstat (limited to 'examples/qmlscatter')
-rw-r--r-- | examples/qmlscatter/doc/images/qmlscatter-example.png | bin | 60798 -> 98086 bytes | |||
-rw-r--r-- | examples/qmlscatter/doc/src/qmlscatter.qdoc | 22 | ||||
-rw-r--r-- | examples/qmlscatter/main.cpp | 14 | ||||
-rw-r--r-- | examples/qmlscatter/qml/qmlscatter/data.qml | 3 | ||||
-rw-r--r-- | examples/qmlscatter/qml/qmlscatter/main.qml | 44 | ||||
-rw-r--r-- | examples/qmlscatter/qml/qmlscatter/newbutton.qml | 2 |
6 files changed, 45 insertions, 40 deletions
diff --git a/examples/qmlscatter/doc/images/qmlscatter-example.png b/examples/qmlscatter/doc/images/qmlscatter-example.png Binary files differindex ff9df1fc..65ec4816 100644 --- a/examples/qmlscatter/doc/images/qmlscatter-example.png +++ b/examples/qmlscatter/doc/images/qmlscatter-example.png diff --git a/examples/qmlscatter/doc/src/qmlscatter.qdoc b/examples/qmlscatter/doc/src/qmlscatter.qdoc index 06719ffc..366b02ea 100644 --- a/examples/qmlscatter/doc/src/qmlscatter.qdoc +++ b/examples/qmlscatter/doc/src/qmlscatter.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** @@ -46,8 +46,13 @@ \snippet ../examples/qmlscatter/main.cpp 0 - This will help us when deploying the application to Android. We'll also change the application - to be shown maximized by replacing + This will help us when deploying the application to Android. + + We'll enable anti-aliasing for our application in environments that support it: + + \snippet ../examples/qmlscatter/main.cpp 2 + + We'll also change the application to be shown maximized by replacing \code viewer.showExpanded(); \endcode @@ -112,19 +117,22 @@ \snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 3 - We added a built-in Theme3D and changed the font in it. We also changed the shadow quality. + We added a customized theme and changed the shadow quality. We're happy with the other visual properties, so we won't change them. + The custom theme is based on a predefined theme, but we change the font in it: + + \snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 13 + Then it's time to start feeding the graph some data. \section1 Adding data to the graph - Let's create a \c Data item inside the \c mainView and name it \c {seriesOneData}: + Let's create a \c Data item inside the \c mainView and name it \c seriesData: \snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 4 - We'll add two more of these: \c seriesTwoData and \c seriesThreeData to add to the three series - we're going to have. They are added similarly as \c {seriesOneData}. + The \c seriesData item contains the data models for all three series we use in this example. This is the component that holds our data in \c {data.qml}. It has an \c Item as the main component. diff --git a/examples/qmlscatter/main.cpp b/examples/qmlscatter/main.cpp index 159612e9..4ecefdc1 100644 --- a/examples/qmlscatter/main.cpp +++ b/examples/qmlscatter/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** @@ -16,6 +16,7 @@ ** ****************************************************************************/ +#include <QtDataVisualization/qutils.h> #include <QtGui/QGuiApplication> #include "qtquick2applicationviewer.h" #ifdef Q_OS_ANDROID @@ -30,15 +31,10 @@ int main(int argc, char *argv[]) QtQuick2ApplicationViewer viewer; -#if !defined(QT_OPENGL_ES_2) // Enable antialiasing - QSurfaceFormat surfaceFormat; - surfaceFormat.setDepthBufferSize(24); - surfaceFormat.setSamples(8); - surfaceFormat.setRenderableType(QSurfaceFormat::OpenGL); - surfaceFormat.setSwapBehavior(QSurfaceFormat::DoubleBuffer); - viewer.setFormat(surfaceFormat); -#endif + //! [2] + viewer.setFormat(QtDataVisualization::qDefaultSurfaceFormat()); + //! [2] #ifdef Q_OS_ANDROID viewer.addImportPath(QString::fromLatin1("assets:/qml")); diff --git a/examples/qmlscatter/qml/qmlscatter/data.qml b/examples/qmlscatter/qml/qmlscatter/data.qml index bf4853df..23c4e5d5 100644 --- a/examples/qmlscatter/qml/qmlscatter/data.qml +++ b/examples/qmlscatter/qml/qmlscatter/data.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** @@ -17,7 +17,6 @@ ****************************************************************************/ import QtQuick 2.1 -import QtDataVisualization 1.0 Item { //! [1] diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml index 62727f84..beb4ccaa 100644 --- a/examples/qmlscatter/qml/qmlscatter/main.qml +++ b/examples/qmlscatter/qml/qmlscatter/main.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** @@ -30,16 +30,22 @@ Item { //! [4] Data { - id: seriesOneData + id: seriesData } //! [4] - Data { - id: seriesTwoData + //! [13] + Theme3D { + id: themeIsabelle + type: Theme3D.ThemeIsabelle + font.family: "Lucida Handwriting" + font.pointSize: 40 } + //! [13] - Data { - id: seriesThreeData + Theme3D { + id: themeArmyBlue + type: Theme3D.ThemeArmyBlue } //! [8] @@ -59,11 +65,7 @@ Item { height: dataView.height //! [2] //! [3] - theme: Theme3D { - type: Theme3D.ThemeIsabelle - font.family: "Lucida Handwriting" - font.pointSize: 40 - } + theme: themeIsabelle shadowQuality: AbstractGraph3D.ShadowQualitySoftLow //! [3] //! [6] @@ -87,7 +89,7 @@ Item { //! [11] ItemModelScatterDataProxy { - itemModel: seriesOneData.model + itemModel: seriesData.model xPosRole: "xPos" yPosRole: "yPos" zPosRole: "zPos" @@ -104,7 +106,7 @@ Item { //! [12] ItemModelScatterDataProxy { - itemModel: seriesTwoData.modelTwo + itemModel: seriesData.modelTwo xPosRole: "xPos" yPosRole: "yPos" zPosRole: "zPos" @@ -117,7 +119,7 @@ Item { mesh: Abstract3DSeries.MeshMinimal ItemModelScatterDataProxy { - itemModel: seriesThreeData.modelThree + itemModel: seriesData.modelThree xPosRole: "xPos" yPosRole: "yPos" zPosRole: "zPos" @@ -188,14 +190,14 @@ Item { text: "Change Theme" onClicked: { if (scatterGraph.theme.type === Theme3D.ThemeArmyBlue) { - // Ownership of the theme is transferred and old theme is destroyed when setting - // a new one, so we need to create them dynamically - scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0; - Theme3D {type: Theme3D.ThemeIsabelle; font.family: "Lucida Handwriting"; - font.pointSize: 40}', parent); + scatterGraph.theme = themeIsabelle + } else { + scatterGraph.theme = themeArmyBlue + } + if (scatterGraph.theme.backgroundEnabled === true) { + backgroundToggle.text = "Hide Background"; } else { - scatterGraph.theme = Qt.createQmlObject('import QtDataVisualization 1.0; - Theme3D {type: Theme3D.ThemeArmyBlue}', parent); + backgroundToggle.text = "Show Background"; } } } diff --git a/examples/qmlscatter/qml/qmlscatter/newbutton.qml b/examples/qmlscatter/qml/qmlscatter/newbutton.qml index e44c9d1a..e4fb99d2 100644 --- a/examples/qmlscatter/qml/qmlscatter/newbutton.qml +++ b/examples/qmlscatter/qml/qmlscatter/newbutton.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc +** Copyright (C) 2014 Digia Plc ** All rights reserved. ** For any questions to Digia, please use contact form at http://qt.digia.com ** |