summaryrefslogtreecommitdiffstats
path: root/basicsuite/ebike-ui/StatsBox.qml
diff options
context:
space:
mode:
authorMikko Gronoff <mikko.gronoff@qt.io>2018-09-14 10:25:01 +0300
committerMikko Gronoff <mikko.gronoff@qt.io>2018-09-14 10:27:21 +0300
commit97863a4992276a3d1aeb3c1bb9ef5a280a5e8b12 (patch)
treeb38f6f152e7036b91c25834a917e320955660db2 /basicsuite/ebike-ui/StatsBox.qml
parent8be609623fc646e8d9642fc8481a1b9e59fb8417 (diff)
parentaa8e21cc3f60e54dd9c5d1ec482ca440857568f0 (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
* origin/5.11: aa8e21c Add new Qt3D demo ca03367 Exclude demos from colibri imx6ull a5345fd qtwebbrowser: merge changes from qtwebbrowser git repo d7e9731 do not enable highdpiscaling on emulator f730907 Fix mediaplayer default video path 09aa32d Fix some major scaling & font issues on ebike-demo Change-Id: I044c29ea2908a6254f32b0623037ea63f23d25cb
Diffstat (limited to 'basicsuite/ebike-ui/StatsBox.qml')
-rw-r--r--basicsuite/ebike-ui/StatsBox.qml58
1 files changed, 28 insertions, 30 deletions
diff --git a/basicsuite/ebike-ui/StatsBox.qml b/basicsuite/ebike-ui/StatsBox.qml
index 7d6f24c..76254db 100644
--- a/basicsuite/ebike-ui/StatsBox.qml
+++ b/basicsuite/ebike-ui/StatsBox.qml
@@ -42,19 +42,21 @@ import "./BikeStyle"
// Top-left corner, stats
Item {
- width: 320
- height: UILayout.topViewHeight
+ width: root.width * 0.425
+ height: root.height * 0.45
+ property real imageMargin: Math.min(width, height) * 0.3
Image {
id: tripIcon
- width: UILayout.statsIconWidth
- height: UILayout.statsIconHeight
+ width: Math.min(parent.width, parent.height) * 0.15
+ height: width
source: "images/trip.png"
+ fillMode: Image.PreserveAspectFit
anchors {
- top: parent.top
left: parent.left
- topMargin: UILayout.statsIconTop
- leftMargin: UILayout.statsIconLeft
+ leftMargin: imageMargin
+ top: parent.top
+ topMargin: imageMargin
}
}
@@ -62,46 +64,45 @@ Item {
id: tripText
color: Colors.distanceText
anchors {
- top: tripIcon.top
- topMargin: UILayout.statsTextTopOffset
+ bottom: tripIcon.verticalCenter
+ bottomMargin: -imageMargin * 0.05
left: tripIcon.right
- leftMargin: UILayout.statsTextSeparator
}
font {
family: "Montserrat, Bold"
weight: Font.Bold
- pixelSize: UILayout.statsTextSize
+ pixelSize: parent.height * 0.1
}
text: datastore.trip.toFixed(1)
+ verticalAlignment: Text.AlignBottom
}
Text {
id: tripUnitText
color: Colors.distanceUnit
anchors {
- baseline: tripIcon.bottom
- baselineOffset: -UILayout.statsUnitBaselineOffset
+ top: tripText.bottom
left: tripIcon.right
- leftMargin: UILayout.statsTextSeparator
}
font {
family: "Montserrat, Light"
weight: Font.Light
- pixelSize: UILayout.statsTextSize
+ pixelSize: parent.height * 0.065
}
+ verticalAlignment: Text.AlignTop
text: datastore.unit === DataStore.Kmh ? "km" : "mi."
}
Image {
id: calIcon
- width: UILayout.statsIconWidth
- height: UILayout.statsIconHeight
+ width: Math.min(parent.width, parent.height) * 0.15
+ height: width
source: "images/calories.png"
anchors {
- top: tripIcon.bottom
left: parent.left
- topMargin: UILayout.statsIconSeparator
- leftMargin: UILayout.statsIconLeft
+ leftMargin: imageMargin
+ top: tripIcon.bottom
+ topMargin: imageMargin * 0.25
}
}
@@ -109,15 +110,14 @@ Item {
id: calText
color: Colors.distanceText
anchors {
- top: calIcon.top
- topMargin: UILayout.statsTextTopOffset
+ bottom: calIcon.verticalCenter
+ bottomMargin: -imageMargin * 0.05
left: calIcon.right
- leftMargin: UILayout.statsTextSeparator
}
font {
family: "Montserrat, Bold"
weight: Font.Bold
- pixelSize: UILayout.statsTextSize
+ pixelSize: parent.height * 0.1
}
text: datastore.calories.toFixed(0)
}
@@ -126,21 +126,19 @@ Item {
id: calUnitText
color: Colors.distanceUnit
anchors {
- baseline: calIcon.bottom
- baselineOffset: -UILayout.statsUnitBaselineOffset
+ top: calText.bottom
left: calIcon.right
- leftMargin: UILayout.statsTextSeparator
}
font {
family: "Montserrat, Light"
weight: Font.Light
- pixelSize: UILayout.statsTextSize
+ pixelSize: parent.height * 0.065
}
text: "kcal"
}
Rectangle {
- width: UILayout.horizontalViewSeparatorWidth
+ width: parent.width * 0.775
height: UILayout.horizontalViewSeparatorHeight
anchors.bottom: parent.bottom
anchors.left: parent.left
@@ -149,7 +147,7 @@ Item {
Rectangle {
width: UILayout.verticalViewSeparatorWidth
- height: UILayout.verticalViewSeparatorHheightTop
+ height: parent.height * 0.475
anchors.top: parent.top
anchors.right: parent.right
color: Colors.separator