diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-08-08 08:10:23 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-08-08 08:21:49 +0300 |
commit | 5f35cb89650e02aa751f51f12bcad61caa6e9752 (patch) | |
tree | 75ef33b0ae58cfeb67c3bb07d0931c24110af234 /examples/qmlscatter/qml/qmlscatter/main.qml | |
parent | ebee290095f9a32dbcf5956e9fed50d2610cbfe1 (diff) |
DeclarativeScatter example added
+ fixed auto-scaling
Change-Id: I420dd8ecb0ad11c5a9c7d8317ff4c13878b5bc59
Change-Id: I420dd8ecb0ad11c5a9c7d8317ff4c13878b5bc59
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples/qmlscatter/qml/qmlscatter/main.qml')
-rw-r--r-- | examples/qmlscatter/qml/qmlscatter/main.qml | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml new file mode 100644 index 00000000..7b3aa594 --- /dev/null +++ b/examples/qmlscatter/qml/qmlscatter/main.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** 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. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial 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 +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import com.digia.QtDataVis3D 1.0 + +Item { + id: mainview + width: 800 + height: 500 + visible: true + + Item { + id: dataView + width: parent.width + height: parent.height - shadowToggle.height + anchors.bottom: parent.bottom + + ScatterDataMapping { + id: scatterMapping + xPosRole: "xPos" + yPosRole: "yPos" + zPosRole: "zPos" + } + + ListModel { + id: dataModel +// ListElement{ xPos: -100.0; yPos: 490.0; zPos: -50.0 } +// ListElement{ xPos: 100.0; yPos: 105.0; zPos: 50.0 } +// ListElement{ xPos: 50.0; yPos: 465.0; zPos: -50.0 } +// ListElement{ xPos: -50.0; yPos: 225.0; zPos: 50.0 } + ListElement{ xPos: -1.0; yPos: 4.3; zPos: -0.5 } + ListElement{ xPos: 1.0; yPos: 0.105; zPos: 0.5 } + ListElement{ xPos: 0.5; yPos: -4.65; zPos: -0.5 } + ListElement{ xPos: -0.5; yPos: 0.225; zPos: 0.5 } + ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0 } + ListElement{ xPos: 0.0; yPos: 2.0; zPos: 0.0 } + ListElement{ xPos: 0.0; yPos: -2.0; zPos: 0.0 } + ListElement{ xPos: -1.0; yPos: 4.9; zPos: -1.0 } + ListElement{ xPos: 1.0; yPos: 4.9; zPos: -1.0 } + ListElement{ xPos: -1.0; yPos: 4.9; zPos: 1.0 } + ListElement{ xPos: 1.0; yPos: 4.9; zPos: 1.0 } + ListElement{ xPos: -1.0; yPos: -4.9; zPos: -1.0 } + ListElement{ xPos: 1.0; yPos: -4.9; zPos: -1.0 } + ListElement{ xPos: -1.0; yPos: -4.9; zPos: 1.0 } + ListElement{ xPos: 1.0; yPos: -4.9; zPos: 1.0 } + } + + Scatter3D { + id: testscatter + width: dataView.width + height: dataView.height + fontSize: 300.0 + mapping: scatterMapping + + Component.onCompleted: { + console.log("testscatter complete"); +// console.log(testimage); +// console.log(testimage.sourceSize); +// setBarSpecs(Qt.vector3d(10.0, 10.0, 10.0)); +// setAreaSpecs(Qt.rect(0, 0, testimage.sourceSize.width, testimage.sourceSize.height), +// testimage); +// //setImage(testimage); +// setImage(":/images/floorplan.jpg"); + setTickCount(10, 0.5, -5.0); + shadowQuality = Scatter3D.ShadowNone + selectionMode = Scatter3D.ModeBar + labelTransparency = Scatter3D.TransparencyNoBackground//.TransparencyFromTheme + data = dataModel + } + } + } + + Component.onCompleted: { + console.log("mainview complete"); + } + + Rectangle { + id: shadowToggle + color: "#FFFFFF" + x: 0 + y: 0 + width: parent.width + height: 60 + + TextArea { + id: buttonText + text: "Toggle Shadows" + anchors.fill: parent + textColor: "#000000" + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (testscatter.shadowQuality === Scatter3D.ShadowNone) { + testscatter.shadowQuality = Scatter3D.ShadowLow; + buttonText.textColor = "#999999"; + } else { + testscatter.shadowQuality = Scatter3D.ShadowNone; + buttonText.textColor = "#000000"; + } + } + } + } +} |