summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Dubitskiy <sergey.dubitskiy@nokia.com>2012-01-27 09:02:58 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-27 00:29:49 +0100
commit6a4f23871fd24dccbf5bbf093e664dee0e2e083b (patch)
tree2c5f68aa58be3a1c47087a26e2d65f50d54bbcdf
parente92cfb37d49b187c38016f6c1d268b8e000ee7d9 (diff)
Bugfix: grid text is drawn correctly even if app window is resized.
Change-Id: I97b5065718343ef219296405a41dd9cedd37a67c Reviewed-by: Christopher Ham <christopher.ham@nokia.com> Reviewed-by: Danny Pope <daniel.pope@nokia.com>
-rw-r--r--util/qt3d/modeltweak/qml/ModelViewport.qml41
1 files changed, 27 insertions, 14 deletions
diff --git a/util/qt3d/modeltweak/qml/ModelViewport.qml b/util/qt3d/modeltweak/qml/ModelViewport.qml
index b5188d57..ed311837 100644
--- a/util/qt3d/modeltweak/qml/ModelViewport.qml
+++ b/util/qt3d/modeltweak/qml/ModelViewport.qml
@@ -314,19 +314,27 @@ Rectangle {
font.pixelSize: 16
}
+ // --------- grid text begin ---------
+
+ property bool bTall: view.width<view.height;
+ property int minimalDimension: (bTall) ? view.width : view.height;
+ property int textStep: minimalDimension/8;
+
+ // horizontal
Text {
id: h_minus100
text: -1.0*cameraZoom
- x: (view.width/10) - 6
+ x: view.width/2 - 4*textStep - 10
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
+ visible: bTall==false
}
Text {
id: h_minus075
text: -0.75*cameraZoom
- x: 2*(view.width/10) - 7
+ x: view.width/2 - 3*textStep - 10
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
@@ -334,7 +342,7 @@ Rectangle {
Text {
id: h_minus050
text: -0.5*cameraZoom
- x: 3*(view.width/10) - 8
+ x: view.width/2 - 2*textStep - 10
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
@@ -342,7 +350,7 @@ Rectangle {
Text {
id: h_minus025
text: -0.25*cameraZoom
- x: 4*(view.width/10) - 9
+ x: view.width/2 - textStep - 10
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
@@ -358,7 +366,7 @@ Rectangle {
Text {
id: h_plus025
text: 0.25*cameraZoom
- x: 6*(view.width/10) - 11
+ x: view.width/2 + textStep - 5
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
@@ -366,7 +374,7 @@ Rectangle {
Text {
id: h_plus050
text: 0.5*cameraZoom
- x: 7*(view.width/10) - 12
+ x: view.width/2 + 2*textStep - 5
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
@@ -374,7 +382,7 @@ Rectangle {
Text {
id: h_plus075
text: 0.75*cameraZoom
- x: 8*(view.width/10) - 13
+ x: view.width/2 + 3*textStep - 5
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
@@ -382,17 +390,20 @@ Rectangle {
Text {
id: h_plus100
text: 1.0*cameraZoom
- x: 9*(view.width/10) - 14
+ x: view.width/2 + 4*textStep
y: (view.height/2) - 14
color: "white"
font.pixelSize: 12
+ visible: bTall==false
}
+ // vertical
+
Text {
id: v_minus075
text: -0.75*cameraZoom
x: (view.width/2)
- y: (view.height/8) - 12
+ y: view.height/2 - 3*textStep - 5
color: "white"
font.pixelSize: 12
}
@@ -400,7 +411,7 @@ Rectangle {
id: v_minus050
text: -0.5*cameraZoom
x: (view.width/2)
- y: 2*(view.height/8) - 12
+ y: view.height/2 - 2*textStep - 6
color: "white"
font.pixelSize: 12
}
@@ -408,7 +419,7 @@ Rectangle {
id: v_minus025
text: -0.25*cameraZoom
x: (view.width/2)
- y: 3*(view.height/8) - 12
+ y: view.height/2 - textStep - 7
color: "white"
font.pixelSize: 12
}
@@ -416,7 +427,7 @@ Rectangle {
id: v_plus025
text: 0.25*cameraZoom
x: (view.width/2)
- y: 5*(view.height/8) - 12
+ y: view.height/2 + textStep - 8
color: "white"
font.pixelSize: 12
}
@@ -424,7 +435,7 @@ Rectangle {
id: v_plus050
text: 0.5*cameraZoom
x: (view.width/2)
- y: 6*(view.height/8) - 12
+ y: view.height/2 + 2*textStep - 9
color: "white"
font.pixelSize: 12
}
@@ -432,8 +443,10 @@ Rectangle {
id: v_plus075
text: 0.75*cameraZoom
x: (view.width/2)
- y: 7*(view.height/8) - 12
+ y: view.height/2 + 3*textStep - 10
color: "white"
font.pixelSize: 12
}
+
+ // --------- grid text end ---------
}