diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-09 14:01:45 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-10 06:18:20 +0300 |
commit | 2cd23faa1fe1ae68de64b21c89e4a78cc289dc1d (patch) | |
tree | b4e093e3de340cc5803866509e3c3b1bdac2a038 /examples/qmlsurface/qml | |
parent | 0153f9889ee757b0a215e5c36c14a9561cc9b098 (diff) |
QML support for surface added
Task-number: QTRD-2253
- incomplete (as is surface itself)
- documentation incomplete
- example needs better data
Change-Id: I87063925749448c6cad2f1b529f2669514fb1cb9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples/qmlsurface/qml')
-rw-r--r-- | examples/qmlsurface/qml/qmlsurface/button.qml | 59 | ||||
-rw-r--r-- | examples/qmlsurface/qml/qmlsurface/data.qml | 58 | ||||
-rw-r--r-- | examples/qmlsurface/qml/qmlsurface/main.qml | 92 |
3 files changed, 209 insertions, 0 deletions
diff --git a/examples/qmlsurface/qml/qmlsurface/button.qml b/examples/qmlsurface/qml/qmlsurface/button.qml new file mode 100644 index 00000000..75032c39 --- /dev/null +++ b/examples/qmlsurface/qml/qmlsurface/button.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 + +Item { + id: button + + property alias text: buttonText.text + property alias color: buttonRectangle.color + property alias radius: buttonRectangle.radius + + property color defaultColor: "steelblue" + property color pressedColor: "lightsteelblue" + property color borderColor: "darkblue" + + signal clicked + + height: 75 + + Rectangle { + id: buttonRectangle + width: parent.width + height: parent.height + color: defaultColor + radius: 5 + border.color: borderColor + + Text { + id: buttonText + wrapMode: Text.WordWrap + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + anchors.fill: parent + } + + MouseArea { + anchors.fill: parent + onPressed: buttonRectangle.color = pressedColor + onReleased: buttonRectangle.color = defaultColor + onClicked: button.clicked() + } + } +} diff --git a/examples/qmlsurface/qml/qmlsurface/data.qml b/examples/qmlsurface/qml/qmlsurface/data.qml new file mode 100644 index 00000000..c1601e71 --- /dev/null +++ b/examples/qmlsurface/qml/qmlsurface/data.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 +import com.digia.QtDataVis3D 1.0 + +Item { + property alias mapping: surfaceMapping + property alias model: dataModel + property alias proxy: modelProxy + + SurfaceDataMapping { + id: surfaceMapping + rowRole: "year" + columnRole: "month" + valueRole: "expenses" + rowCategories: ["2000", "2001", "2002", "2003"] + columnCategories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + } + + ItemModelSurfaceDataProxy { + id: modelProxy + activeMapping: surfaceMapping + itemModel: dataModel + } + + ListModel { + id: dataModel + ListElement{ year: "2000"; month: "Jan"; expenses: "3"; } + ListElement{ year: "2000"; month: "Feb"; expenses: "8"; } + ListElement{ year: "2000"; month: "Mar"; expenses: "10"; } + ListElement{ year: "2000"; month: "Apr"; expenses: "12"; } + ListElement{ year: "2000"; month: "May"; expenses: "10"; } + ListElement{ year: "2000"; month: "Jun"; expenses: "5"; } + ListElement{ year: "2000"; month: "Jul"; expenses: "1"; } + ListElement{ year: "2000"; month: "Aug"; expenses: "7"; } + ListElement{ year: "2000"; month: "Sep"; expenses: "4"; } + ListElement{ year: "2000"; month: "Oct"; expenses: "22"; } + ListElement{ year: "2000"; month: "Nov"; expenses: "16"; } + ListElement{ year: "2000"; month: "Dec"; expenses: "2"; } + } +} diff --git a/examples/qmlsurface/qml/qmlsurface/main.qml b/examples/qmlsurface/qml/qmlsurface/main.qml new file mode 100644 index 00000000..b5b0cc87 --- /dev/null +++ b/examples/qmlsurface/qml/qmlsurface/main.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVis3D module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import com.digia.QtDataVis3D 1.0 +import "." + +Item { + id: mainview + width: 1280 + height: 1024 + visible: true + + Data { + id: surfaceData + } + + Item { + id: surfaceView + width: mainview.width - surfaceGridToggle.width + height: mainview.height + anchors.right: mainview.right; + + Surface3D { + id: surfaceplot + width: surfaceView.width + height: surfaceView.height + //shadowQuality: Surface3D.ShadowMedium + font.pointSize: 35 + cameraPreset: Surface3D.PresetIsometricLeft + itemLabelFormat: "X:@xLabel Y:@yLabel Z:@zLabel" + dataProxy: surfaceData.proxy +// axisX.segmentCount: 4 +// axisX.subSegmentCount: 1 +// axisX.labelFormat: "%.2f" +// axisZ.segmentCount: 1 +// axisZ.subSegmentCount: 1 +// axisZ.labelFormat: "%.2f" +// axisY.segmentCount: 1 +// axisY.subSegmentCount: 1 +// axisY.labelFormat: "%.2f" + } + } + + Button { + id: surfaceGridToggle + anchors.left: parent.left + width: 200 + text: "Hide Surface Grid" + onClicked: { + if (surfaceplot.surfaceGrid == false) { + surfaceplot.surfaceGrid = true; + text = "Hide Surface Grid" + } else { + surfaceplot.surfaceGrid = false; + text = "Show Surface Grid" + } + } + } + + Button { + id: smoothSurfaceToggle + anchors.top: surfaceGridToggle.bottom + width: surfaceGridToggle.width + text: "Show Smooth" + onClicked: { + if (surfaceplot.smoothSurface == true) { + surfaceplot.smoothSurface = false; + text = "Show Smooth" + } else { + surfaceplot.smoothSurface = true; + text = "Show Flat" + } + } + } +} |