summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Burke <patrick.burke@nokia.com>2011-11-16 13:13:57 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-17 01:02:10 +0100
commit850a561a83b5da4a620b5bba1812919d58600c56 (patch)
treefb634e3407f34a47816ece5925f70fde005b0ecb
parent0c6d35949ce3b58468771a375fb55d3785d58d09 (diff)
ModelTweaker: viewport transitions implemented
Change-Id: If2169810994418a08eed4cb2aa53200eb65d55c2 Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
-rw-r--r--util/qt3d/modeltweak/qml/BlenderValueSlider.qml1
-rw-r--r--util/qt3d/modeltweak/qml/ModelTweak.qml44
-rw-r--r--util/qt3d/modeltweak/qml/ModelViewport.qml24
3 files changed, 53 insertions, 16 deletions
diff --git a/util/qt3d/modeltweak/qml/BlenderValueSlider.qml b/util/qt3d/modeltweak/qml/BlenderValueSlider.qml
index 9895a354..67e77506 100644
--- a/util/qt3d/modeltweak/qml/BlenderValueSlider.qml
+++ b/util/qt3d/modeltweak/qml/BlenderValueSlider.qml
@@ -18,7 +18,6 @@ Item {
Rectangle {
id: rect
- anchors.right: parent.right
radius: 8
border.width: 1
border.color: "#191919"
diff --git a/util/qt3d/modeltweak/qml/ModelTweak.qml b/util/qt3d/modeltweak/qml/ModelTweak.qml
index 63dd8daa..d4426d4f 100644
--- a/util/qt3d/modeltweak/qml/ModelTweak.qml
+++ b/util/qt3d/modeltweak/qml/ModelTweak.qml
@@ -94,10 +94,10 @@ Rectangle {
ModelViewport {
id: mvpZY
- visible: !mvpXY.isBig && !mvpXZ.isBig ? true : false
- x: isBig ? 0 : 0;
- y: isBig ? 0 : 0;
+ x: 0;
+ y: 0;
camera.eye: Qt.vector3d(10, 0, 0);
+ stateName: "ZYMaximised"
function translateMouseX(mouse) {
transformTranslate.translate =
@@ -133,10 +133,10 @@ Rectangle {
ModelViewport {
id: mvpXY
- visible: !mvpZY.isBig && !mvpXZ.isBig ? true : false
- x: isBig ? 0 : parent.width/2
- y: isBig ? 0 : 0;
+ x: parent.width/2
+ y: 0;
camera.eye: Qt.vector3d(0, 0, 10);
+ stateName: "XYMaximised"
function translateMouseX(mouse) {
transformTranslate.translate =
@@ -172,11 +172,11 @@ Rectangle {
ModelViewport {
id: mvpXZ
- visible: !mvpZY.isBig && !mvpXY.isBig ? true : false
- x: isBig ? 0 : parent.width/2;
- y: isBig ? 0 : parent.height/2;
+ x: parent.width/2;
+ y: parent.height/2;
camera.eye: Qt.vector3d(0, 10, 0);
camera.upVector: Qt.vector3d(0, 0, -1);
+ stateName: "XZMaximised"
function translateMouseX(mouse) {
transformTranslate.translate =
@@ -236,4 +236,30 @@ Rectangle {
id: helpOverlay
visible: false
}
+
+ states: [
+ State {
+ name: "3Views"
+ },
+ State {
+ name: "ZYMaximised"
+ PropertyChanges { target: mvpZY; x: 0; y: 0; width: mainwindow.width; height: mainwindow.height; }
+ PropertyChanges { target: mvpXY; x: mainwindow.width; y: 0; width: 0; height: mainwindow.height/2; }
+ PropertyChanges { target: mvpXZ; x: mainwindow.width; y: mainwindow.height; width: 0; height: 0; }
+ },
+ State {
+ name: "XYMaximised"
+ PropertyChanges { target: mvpZY; x: 0; y: 0; width: 0; height: mainwindow.height/2; }
+ PropertyChanges { target: mvpXY; x: 0; y: 0; width: mainwindow.width; height: mainwindow.height; }
+ PropertyChanges { target: mvpXZ; x: mainwindow.width/2; y: mainwindow.height; width: mainwindow.width/2; height: 0; }
+ },
+ State {
+ name: "XZMaximised"
+ PropertyChanges { target: mvpZY; x: 0; y: 0; width: 0; height: 0; }
+ PropertyChanges { target: mvpXY; x: mainwindow.width/2; y: 0; width: mainwindow.width/2; height: 0; }
+ PropertyChanges { target: mvpXZ; x: 0; y: 0; width: mainwindow.width; height: mainwindow.height; }
+ }
+ ]
+
+ state: "3Views"
}
diff --git a/util/qt3d/modeltweak/qml/ModelViewport.qml b/util/qt3d/modeltweak/qml/ModelViewport.qml
index 3a812cb9..c633898e 100644
--- a/util/qt3d/modeltweak/qml/ModelViewport.qml
+++ b/util/qt3d/modeltweak/qml/ModelViewport.qml
@@ -3,14 +3,12 @@ import Qt3D 1.0
Rectangle {
id: view
- width: isBig ? parent.width : parent.width/2;
- height: isBig ? parent.height : parent.height/2
+ width: parent.width/2;
+ height: parent.height/2
color: parent.color
border.color: parent.border.color
- property bool isBig: false;
-
property alias itemPosition: mainItem.position;
property alias itemScale: mainItem.scale;
property alias camera: viewport.camera
@@ -45,6 +43,13 @@ Rectangle {
property double rotateSensitivity: 8;
property double scaleSensitivity: 32;
+ property string stateName
+
+ Behavior on x { NumberAnimation { duration: 300 } }
+ Behavior on y { NumberAnimation { duration: 300 } }
+ Behavior on width { NumberAnimation { duration: 300 } }
+ Behavior on height { NumberAnimation { duration: 300 } }
+
Viewport {
id: viewport
anchors.fill: parent
@@ -140,12 +145,19 @@ Rectangle {
Image {
id: img
- source: view.isBig ? "images/shrink.png" : "images/grow.png"
+ source: mainwindow.state !== "3Views" ? "images/shrink.png" : "images/grow.png"
x: 2
y: 2
MouseArea {
anchors.fill: parent
- onClicked: isBig = !isBig
+ onClicked: {
+ if (view.stateName) {
+ if(mainwindow.state !== "3Views")
+ mainwindow.state = "3Views"
+ else
+ mainwindow.state = view.stateName
+ }
+ }
}
}
}