diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-12-19 13:38:31 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-12-19 14:41:42 +0200 |
commit | dcf57ae33cbe173724f7f18d94c3d67cac27fac1 (patch) | |
tree | 611607f6a4263a4808fb84b93b2d19d363a20549 | |
parent | ceda9bb5f39305d8f6467f574c7c7693b8a779f8 (diff) |
Documentation and example fixes
Task-id: QTRD-2744
Change-Id: I901f05b737e24c363d7ed897e1baadc9f9a03333
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
9 files changed, 123 insertions, 66 deletions
diff --git a/examples/qmlbars/qml/qmlbars/main.qml b/examples/qmlbars/qml/qmlbars/main.qml index 1f8c1a3d..0581f834 100644 --- a/examples/qmlbars/qml/qmlbars/main.qml +++ b/examples/qmlbars/qml/qmlbars/main.qml @@ -27,7 +27,6 @@ Item { id: mainview width: 1280 height: 1024 - visible: true property int buttonLayoutHeight: 180; state: Screen.width < Screen.height ? "portrait" : "landscape" diff --git a/examples/qmlcustominput/qml/qmlcustominput/main.qml b/examples/qmlcustominput/qml/qmlcustominput/main.qml index 2a235986..54ec3342 100644 --- a/examples/qmlcustominput/qml/qmlcustominput/main.qml +++ b/examples/qmlcustominput/qml/qmlcustominput/main.qml @@ -25,7 +25,6 @@ Item { id: mainView width: 1280 height: 720 - visible: true Data { id: graphData diff --git a/examples/qmlscatter/doc/src/qmlscatter.qdoc b/examples/qmlscatter/doc/src/qmlscatter.qdoc index b0f1fd1f..06719ffc 100644 --- a/examples/qmlscatter/doc/src/qmlscatter.qdoc +++ b/examples/qmlscatter/doc/src/qmlscatter.qdoc @@ -86,10 +86,15 @@ The last \c import just imports all the qml files in the same directory as our \c {main.qml}, because that's where \c newbutton.qml and \c data.qml are. - Then we create our main \c Item, call it \c mainView and set it visible: + Then we create our main \c Item and call it \c mainView: \snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 1 + \note The Qt Creator application wizard will set a \c Rectangle item as the main item, which + is opaque white by default. This doesn't work for us, because the graphs are rendered behind the other + QML elements. We change the main item type to \c Item, which is invisible. This way the graph is + not covered by the main item. + Then we'll add another \c Item inside it, and call it \c dataView. This will be the item to hold the Scatter3D graph. We'll anchor it to the parent bottom: diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml index 22eab76b..62727f84 100644 --- a/examples/qmlscatter/qml/qmlscatter/main.qml +++ b/examples/qmlscatter/qml/qmlscatter/main.qml @@ -26,7 +26,6 @@ import "." //! [1] Item { id: mainView - visible: true //! [1] //! [4] diff --git a/examples/qmlsurface/qml/qmlsurface/main.qml b/examples/qmlsurface/qml/qmlsurface/main.qml index 07a07891..9f37a3f5 100644 --- a/examples/qmlsurface/qml/qmlsurface/main.qml +++ b/examples/qmlsurface/qml/qmlsurface/main.qml @@ -25,7 +25,6 @@ Item { id: mainview width: 1280 height: 720 - visible: true property int buttonMaximumWidth: surfaceGridToggle.width property int buttonMinimumHeight: seriesToggle.height diff --git a/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp index 03f6e847..623f7f6f 100644 --- a/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp +++ b/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp @@ -21,86 +21,124 @@ import QtDataVisualization 1.0 //! [0] //! [1] -Bars3D { - rows: 4 - columns: 4 - barSpacing: Qt.size(0.5, 0.5) - barSpacingRelative: false - - Bar3DSeries { - itemLabelFormat: "@valueTitle for @colLabel, @rowLabel: @valueLabel" - - ItemModelBarDataProxy { - itemModel: model // E.g. a list model defined elsewhere containing monthly expenses data. - // Mapping model roles to bar series rows, columns, and values. - rowRole: "year" - columnRole: "city" - valueRole: "expenses" - rowCategories: ["2010", "2011", "2012", "2013"] - columnCategories: ["Oulu", "Rauma", "Helsinki", "Tampere"] +import QtQuick 2.0 +import QtDataVisualization 1.0 + +Item { + width: 640 + height: 480 + + Bars3D { + width: parent.width + height: parent.height + + Bar3DSeries { + itemLabelFormat: "@colLabel, @rowLabel: @valueLabel" + + ItemModelBarDataProxy { + itemModel: dataModel + // Mapping model roles to bar series rows, columns, and values. + rowRole: "year" + columnRole: "city" + valueRole: "expenses" + } } } + + ListModel { + id: dataModel + ListElement{ year: "2012"; city: "Oulu"; expenses: "4200"; } + ListElement{ year: "2012"; city: "Rauma"; expenses: "2100"; } + ListElement{ year: "2012"; city: "Helsinki"; expenses: "7040"; } + ListElement{ year: "2012"; city: "Tampere"; expenses: "4330"; } + ListElement{ year: "2013"; city: "Oulu"; expenses: "3960"; } + ListElement{ year: "2013"; city: "Rauma"; expenses: "1990"; } + ListElement{ year: "2013"; city: "Helsinki"; expenses: "7230"; } + ListElement{ year: "2013"; city: "Tampere"; expenses: "4650"; } + } } //! [1] //! [2] -Scatter3D { - axisX.segmentCount: 2 - axisX.subSegmentCount: 2 - axisX.labelFormat: "%.2f" - axisZ.segmentCount: 2 - axisZ.subSegmentCount: 2 - axisZ.labelFormat: "%.2f" - axisY.segmentCount: 3 - axisY.subSegmentCount: 2 - axisY.labelFormat: "%.2f" - - Scatter3DSeries { - itemLabelFormat: "X:@xLabel Y:@yLabel Z:@zLabel" - - ItemModelScatterDataProxy { - itemModel: model // E.g. a list model defined elsewhere containing point coordinates. - // Mapping model roles to scatter series item coordinates. - xPosRole: "xPos" - yPosRole: "yPos" - zPosRole: "zPos" +import QtQuick 2.0 +import QtDataVisualization 1.0 + +Item { + width: 640 + height: 480 + + Scatter3D { + width: parent.width + height: parent.height + Scatter3DSeries { + ItemModelScatterDataProxy { + itemModel: dataModel + // Mapping model roles to scatter series item coordinates. + xPosRole: "xPos" + yPosRole: "yPos" + zPosRole: "zPos" + } } } + + ListModel { + id: dataModel + ListElement{ xPos: "2.754"; yPos: "1.455"; zPos: "3.362"; } + ListElement{ xPos: "3.164"; yPos: "2.022"; zPos: "4.348"; } + ListElement{ xPos: "4.564"; yPos: "1.865"; zPos: "1.346"; } + ListElement{ xPos: "1.068"; yPos: "1.224"; zPos: "2.983"; } + ListElement{ xPos: "2.323"; yPos: "2.502"; zPos: "3.133"; } + } } //! [2] //! [3] -Surface3D { - axisX.min: 0.0 - axisX.max: 10.0 - axisZ.min: 0.0 - axisZ.max: 10.0 - axisY.min: 0.0 - axisY.max: 5.0 - axisX.segmentCount: 5 - axisX.subSegmentCount: 2 - axisX.labelFormat: "%i" - axisZ.segmentCount: 5 - axisZ.subSegmentCount: 2 - axisZ.labelFormat: "%i" - axisY.segmentCount: 5 - axisY.labelFormat: "%.1f" - - Surface3DSeries { - ItemModelSurfaceDataProxy { - itemModel: model // E.g. a list model defined elsewhere containing population data. - // Mapping model roles to surface series rows, columns, and values. - rowRole: "longitude" - columnRole: "latitude" - valueRole: "pop_density" +import QtQuick 2.0 +import QtDataVisualization 1.0 + +Item { + width: 640 + height: 480 + + Surface3D { + width: parent.width + height: parent.height + Surface3DSeries { + itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel" + ItemModelSurfaceDataProxy { + itemModel: dataModel + // Mapping model roles to surface series rows, columns, and values. + rowRole: "longitude" + columnRole: "latitude" + valueRole: "pop_density" + } } } + ListModel { + id: dataModel + ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; } + ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; } + ListElement{ longitude: "22"; latitude: "10"; pop_density: "1.24"; } + ListElement{ longitude: "23"; latitude: "10"; pop_density: "2.53"; } + ListElement{ longitude: "20"; latitude: "11"; pop_density: "2.55"; } + ListElement{ longitude: "21"; latitude: "11"; pop_density: "2.03"; } + ListElement{ longitude: "22"; latitude: "11"; pop_density: "3.46"; } + ListElement{ longitude: "23"; latitude: "11"; pop_density: "5.12"; } + ListElement{ longitude: "20"; latitude: "12"; pop_density: "1.37"; } + ListElement{ longitude: "21"; latitude: "12"; pop_density: "2.98"; } + ListElement{ longitude: "22"; latitude: "12"; pop_density: "3.33"; } + ListElement{ longitude: "23"; latitude: "12"; pop_density: "3.23"; } + ListElement{ longitude: "20"; latitude: "13"; pop_density: "4.34"; } + ListElement{ longitude: "21"; latitude: "13"; pop_density: "3.54"; } + ListElement{ longitude: "22"; latitude: "13"; pop_density: "1.65"; } + ListElement{ longitude: "23"; latitude: "13"; pop_density: "2.67"; } + } } //! [3] //! [7] ItemModelBarDataProxy { - itemModel: model // E.g. a list model defined elsewhere containing monthly expenses data. + itemModel: model // E.g. a list model defined elsewhere containing yearly expenses data. // Mapping model roles to bar series rows, columns, and values. rowRole: "year" columnRole: "city" diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc index fc1b732c..edeb5530 100644 --- a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc +++ b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc @@ -36,6 +36,11 @@ * * See \l{Qt Quick 2 Bars Example} for more thorough usage example. * + * \note Qt Data Visualization graphs are rendered behind any other QML elements on screen, including + * the parent elements of the graph. To make the whole graph show, ensure that no other element + * draws anything over the area the graph occupies. For example, having a non-transparent \c Rectangle + * item as the parent of a graph causes the graph to be hidden. + * * \sa Bar3DSeries, ItemModelBarDataProxy, Scatter3D, Surface3D, {Qt Data Visualization C++ Classes} */ @@ -83,6 +88,7 @@ /*! * \qmlproperty list<QBar3DSeries> Bars3D::seriesList + * \default * This property holds the series of the graph. * By default, this property contains an empty list. * To set the series, either use the addSeries() function or define them as children of the graph. diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc index 1f04424f..0a8e1674 100644 --- a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc +++ b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc @@ -36,6 +36,11 @@ See \l{Qt Quick 2 Scatter Example} for more thorough usage example. + \note Qt Data Visualization graphs are rendered behind any other QML elements on screen, including + the parent elements of the graph. To make the whole graph show, ensure that no other element + draws anything over the area the graph occupies. For example, having a non-transparent \c Rectangle + item as the parent of a graph causes the graph to be hidden. + \sa Scatter3DSeries, ScatterDataProxy, Bars3D, Surface3D, {Qt Data Visualization C++ Classes} */ @@ -68,6 +73,7 @@ /*! * \qmlproperty list<QScatter3DSeries> Scatter3D::seriesList + * \default * This property holds the series of the graph. * By default, this property contains an empty list. * To set the series, either use the addSeries() function or define them as children of the graph. diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc index a3886008..b28d30a7 100644 --- a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc +++ b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc @@ -36,6 +36,11 @@ See \l{Qt Quick 2 Surface Example} for more thorough usage example. + \note Qt Data Visualization graphs are rendered behind any other QML elements on screen, including + the parent elements of the graph. To make the whole graph show, ensure that no other element + draws anything over the area the graph occupies. For example, having a non-transparent \c Rectangle + item as the parent of a graph causes the graph to be hidden. + \sa Surface3DSeries, ItemModelSurfaceDataProxy, Bars3D, Scatter3D, {Qt Data Visualization C++ Classes} */ @@ -74,6 +79,7 @@ /*! * \qmlproperty list<QSurface3DSeries> Surface3D::seriesList + * \default * This property holds the series of the graph. * By default, this property contains an empty list. * To set the series, either use the addSeries() function or define them as children of the graph. |