aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-03-13 12:56:17 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-03-13 14:47:20 +0000
commit1f989828a9a9b02e1e20da77803fec9c7e184dda (patch)
tree5c38c0f33be1b46695eb8c19f42d30e4b1368131
parentd1ac6e3dc8b6919bcba4278a4cef8cbfa83f30a1 (diff)
Wearable: remove unnecessary wrapper items
Almost all pages were centering a fixed-size SwipeView. If the window was larger than assumed, swipes would only work in the center are of the window. Therefore it's better to stretch the view, and just center the content instead. This way swipes work consistently in the whole content area of the page. Change-Id: Idc2a2bc327a49314cbf1271fa34b74df5f633ed8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml172
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml139
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml99
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml157
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml462
5 files changed, 496 insertions, 533 deletions
diff --git a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
index 5dba4e4b..70fe7874 100644
--- a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
@@ -54,115 +54,107 @@ import "../Style"
import "alarms.js" as AlarmData
Item {
- Item {
- anchors.centerIn: parent
+ QQC2.SwipeView {
+ id: svAlarmsContainer
- width: UIStyle.visibleDiameter
- height: width
+ anchors.fill: parent
- QQC2.SwipeView {
- id: svAlarmsContainer
+ clip: true
+ currentIndex: 0
- anchors.fill: parent
- anchors.bottomMargin: 50
+ Item {
+ id: alarmsPage1
- clip: true
- currentIndex: 0
+ Column {
+ anchors.centerIn: parent
+ width: parent.width
+ spacing: 30
- Item {
- id: alarmsPage1
-
- Column {
- anchors.centerIn: parent
- width: parent.width
- spacing: 30
-
- Row {
- anchors.right: parent.right
- anchors.rightMargin: 40
- height: 30
- QQC2.Switch {
- id: alarmsPage1State
- checked: AlarmData.weekdaysAlarmDefaultState()
- }
+ Row {
+ anchors.right: parent.right
+ anchors.rightMargin: 40
+ height: 30
+ QQC2.Switch {
+ id: alarmsPage1State
+ checked: AlarmData.weekdaysAlarmDefaultState()
}
+ }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- height: 30
- text: AlarmData.weekdaysAlarm()
- font.bold: alarmsPage1State.checked
- font.pixelSize: alarmsPage1State.checked ?
- UIStyle.fontSizeXL : UIStyle.fontSizeL
- font.letterSpacing: 4
- color: UIStyle.colorQtGray1
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: 30
+ text: AlarmData.weekdaysAlarm()
+ font.bold: alarmsPage1State.checked
+ font.pixelSize: alarmsPage1State.checked ?
+ UIStyle.fontSizeXL : UIStyle.fontSizeL
+ font.letterSpacing: 4
+ color: UIStyle.colorQtGray1
+ }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- height: 30
- text: qsTr("Week Days")
- font.pixelSize: UIStyle.fontSizeS
- font.italic: true
- font.bold: true
- font.letterSpacing: 1
- color: UIStyle.colorQtGray2
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: 30
+ text: qsTr("Week Days")
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ font.bold: true
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray2
}
}
+ }
- Item {
- id: alarmsPage2
-
- Column {
- anchors.centerIn: parent
- width: parent.width
- spacing: 30
-
- Row {
- anchors.right: parent.right
- anchors.rightMargin: 40
- height: 30
- QQC2.Switch {
- id: alarmsPage2State
- checked: AlarmData.weekendAlarmDefaultState()
- }
+ Item {
+ id: alarmsPage2
+
+ Column {
+ anchors.centerIn: parent
+ width: parent.width
+ spacing: 30
+
+ Row {
+ anchors.right: parent.right
+ anchors.rightMargin: 40
+ height: 30
+ QQC2.Switch {
+ id: alarmsPage2State
+ checked: AlarmData.weekendAlarmDefaultState()
}
+ }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- height: 30
- text: AlarmData.weekendAlarm()
- font.bold: alarmsPage2State.checked
- font.pixelSize: alarmsPage2State.checked ?
- UIStyle.fontSizeXL : UIStyle.fontSizeL
- font.letterSpacing: 4
- color: UIStyle.colorQtGray1
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: 30
+ text: AlarmData.weekendAlarm()
+ font.bold: alarmsPage2State.checked
+ font.pixelSize: alarmsPage2State.checked ?
+ UIStyle.fontSizeXL : UIStyle.fontSizeL
+ font.letterSpacing: 4
+ color: UIStyle.colorQtGray1
+ }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- height: 30
- text: qsTr("Week Ends")
- font.pixelSize: UIStyle.fontSizeS
- font.italic: true
- font.bold: true
- font.letterSpacing: 1
- color: UIStyle.colorQtGray2
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: 30
+ text: qsTr("Week Ends")
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ font.bold: true
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray2
}
}
}
+ }
- QQC2.PageIndicator {
- id: pgAlarmsIndicator
+ QQC2.PageIndicator {
+ id: pgAlarmsIndicator
- anchors.bottom: svAlarmsContainer.bottom
- anchors.bottomMargin: 1
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: svAlarmsContainer.bottom
+ anchors.bottomMargin: 1
+ anchors.horizontalCenter: parent.horizontalCenter
- count: svAlarmsContainer.count
- currentIndex: svAlarmsContainer.currentIndex
- }
+ count: svAlarmsContainer.count
+ currentIndex: svAlarmsContainer.currentIndex
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
index 920f2594..6504c4b3 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
@@ -54,94 +54,87 @@ import "../Style"
import "fitness.js" as FitnessData
Item {
- Item {
- anchors.centerIn: parent
+ QQ2.SwipeView {
+ id: svFitnessContainer
- width: UIStyle.visibleDiameter
- height: UIStyle.visibleRectHeight
+ anchors.fill: parent
- QQ2.SwipeView {
- id: svFitnessContainer
+ clip: true
+ currentIndex: 0
- anchors.fill: parent
+ Item {
+ id: fitnessPage1
- clip: true
- currentIndex: 0
+ Column {
+ anchors.centerIn: parent
+ spacing: 15
- Item {
- id: fitnessPage1
-
- Column {
- anchors.centerIn: parent
- spacing: 15
-
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Steps: ") + FitnessData.getSteps()
- font.italic: true
- font.pixelSize: UIStyle.fontSizeM
- color: UIStyle.colorQtGray1
- }
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- height: 64
- width: 64
- source: "images/man-walking.png"
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Calories: ") + FitnessData.getCalories()
- font.pixelSize: UIStyle.fontSizeS
- font.italic: true
- color: UIStyle.colorQtGray3
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Steps: ") + FitnessData.getSteps()
+ font.italic: true
+ font.pixelSize: UIStyle.fontSizeM
+ color: UIStyle.colorQtGray1
+ }
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: 64
+ width: 64
+ source: "images/man-walking.png"
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Calories: ") + FitnessData.getCalories()
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ color: UIStyle.colorQtGray3
}
}
+ }
- Item {
- id: fitnessPage2
+ Item {
+ id: fitnessPage2
- Column {
- anchors.centerIn: parent
- spacing: 15
+ Column {
+ anchors.centerIn: parent
+ spacing: 15
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Distance: ")
- + FitnessData.getDistance()
- + qsTr(" miles")
- font.italic: true
- font.pixelSize: UIStyle.fontSizeM
- color: UIStyle.colorQtGray1
- }
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- height: 64
- width: 64
- source: "images/man-running.png"
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Time: ")
- + FitnessData.getTime()
- + qsTr(" mins")
- font.pixelSize: UIStyle.fontSizeS
- font.italic: true
- color: UIStyle.colorQtGray3
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Distance: ")
+ + FitnessData.getDistance()
+ + qsTr(" miles")
+ font.italic: true
+ font.pixelSize: UIStyle.fontSizeM
+ color: UIStyle.colorQtGray1
+ }
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: 64
+ width: 64
+ source: "images/man-running.png"
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: qsTr("Time: ")
+ + FitnessData.getTime()
+ + qsTr(" mins")
+ font.pixelSize: UIStyle.fontSizeS
+ font.italic: true
+ color: UIStyle.colorQtGray3
}
}
}
+ }
- QQ2.PageIndicator {
- id: pgFitnessIndicator
+ QQ2.PageIndicator {
+ id: pgFitnessIndicator
- anchors.bottom: svFitnessContainer.bottom
- anchors.bottomMargin: 1
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: svFitnessContainer.bottom
+ anchors.bottomMargin: 1
+ anchors.horizontalCenter: parent.horizontalCenter
- count: svFitnessContainer.count
- currentIndex: svFitnessContainer.currentIndex
- }
+ count: svFitnessContainer.count
+ currentIndex: svFitnessContainer.currentIndex
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
index 95df2676..09b54bd2 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
@@ -53,70 +53,63 @@ import "../Style"
import "navigation.js" as NavigationData
Item {
- Item {
- anchors.centerIn: parent
+ Column {
+ anchors.fill: parent
+ spacing: 2
- width: UIStyle.visibleDiameter
- height: UIStyle.visibleRectHeight
+ Rectangle {
+ id: titleRowCntr
- Column {
- anchors.fill: parent
- spacing: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: parent.width
+ height: 64
- Rectangle {
- id: titleRowCntr
+ color: UIStyle.colorQtGray9
- anchors.horizontalCenter: parent.horizontalCenter
- width: parent.width
- height: 64
+ Row {
+ spacing: 10
+ anchors.centerIn: parent
- color: UIStyle.colorQtGray9
-
- Row {
- spacing: 10
- anchors.centerIn: parent
-
- Image {
- anchors.verticalCenter: parent.verticalCenter
- height: 64
- width: 64
- source: "images/route.png"
- fillMode: Image.PreserveAspectCrop
- }
- Text {
- anchors.verticalCenter: parent.verticalCenter
- text: qsTr("Walking")
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 2
- color: UIStyle.colorQtGray2
- }
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ height: 64
+ width: 64
+ source: "images/route.png"
+ fillMode: Image.PreserveAspectCrop
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: qsTr("Walking")
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 2
+ color: UIStyle.colorQtGray2
}
}
+ }
- ListModel {
- id: routeModel
- }
+ ListModel {
+ id: routeModel
+ }
- ListView {
- id: routeView
+ ListView {
+ id: routeView
- width: parent.width
- height: UIStyle.visibleRectHeight - titleRowCntr.height
- property var imageList: ["straight.png",
- "leftturn.png",
- "rightturn.png",
- "uturn.png",
- "start.png",
- "end.png"]
+ width: parent.width
+ height: UIStyle.visibleRectHeight - titleRowCntr.height
+ property var imageList: ["straight.png",
+ "leftturn.png",
+ "rightturn.png",
+ "uturn.png",
+ "start.png",
+ "end.png"]
- clip: true
- focus: true
- boundsBehavior: Flickable.StopAtBounds
- snapMode: ListView.SnapToItem
- currentIndex: 0
- model: routeModel
- delegate: RouteElement {}
- }
+ clip: true
+ focus: true
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+ currentIndex: 0
+ model: routeModel
+ delegate: RouteElement {}
}
}
Component.onCompleted: {
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
index f1dc6259..2758ef51 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
@@ -54,105 +54,98 @@ import "../Style"
import "notifications.js" as NotificationData
Item {
- Item {
- anchors.centerIn: parent
+ QQC2.SwipeView {
+ id: svNotificationsContainer
- width: UIStyle.visibleDiameter
- height: UIStyle.visibleRectHeight
+ anchors.fill: parent
- QQC2.SwipeView {
- id: svNotificationsContainer
+ clip: true
+ currentIndex: 0
- anchors.fill: parent
+ Item {
+ id: notificationsPage1
- clip: true
- currentIndex: 0
-
- Item {
- id: notificationsPage1
+ ListModel {
+ id: missedCallsList
+ }
- ListModel {
- id: missedCallsList
+ Row {
+ anchors.fill: parent
+ leftPadding: 30
+ spacing: 2
+
+ Image {
+ id: missedCallIcon
+ anchors.verticalCenter: parent.verticalCenter
+ height: 64
+ width: 64
+ source: "images/missedcall.png"
}
- Row {
- anchors.fill: parent
- leftPadding: 30
- spacing: 2
-
- Image {
- id: missedCallIcon
- anchors.verticalCenter: parent.verticalCenter
- height: 64
- width: 64
- source: "images/missedcall.png"
- }
+ ListView {
+ id: missedCallsView
+ width: parent.width - missedCallIcon.width
+ height: parent.height
+
+ clip: true
+ focus: true
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+
+ model: missedCallsList
+
+ delegate: Item {
+ height: missedCallsView.height
+ width: missedCallsView.width
+ Column {
+ anchors.fill: parent
+ spacing: 15
+ topPadding: 35
+ Image {
+ anchors.horizontalCenter:
+ parent.horizontalCenter
+ height: 64
+ width: 64
+ source: (gender == "m") ?
+ "images/avatarm.png"
+ :"images/avatarf.png"
+ }
- ListView {
- id: missedCallsView
- width: parent.width - missedCallIcon.width
- height: parent.height
-
- clip: true
- focus: true
- boundsBehavior: Flickable.StopAtBounds
- snapMode: ListView.SnapToItem
-
- model: missedCallsList
-
- delegate: Item {
- height: missedCallsView.height
- width: missedCallsView.width
- Column {
- anchors.fill: parent
- spacing: 15
- topPadding: 35
- Image {
- anchors.horizontalCenter:
- parent.horizontalCenter
- height: 64
- width: 64
- source: (gender == "m") ?
- "images/avatarm.png"
- :"images/avatarf.png"
- }
-
- Text {
- anchors.horizontalCenter:
- parent.horizontalCenter
- text: name
- font.bold: true
- font.pixelSize: UIStyle.fontSizeS
- color: UIStyle.colorQtGray1
- }
- Text {
- anchors.horizontalCenter:
- parent.horizontalCenter
- text: date + " " + time
- font.pixelSize: UIStyle.fontSizeXS
- font.italic: true
- color: UIStyle.colorQtGray2
- }
+ Text {
+ anchors.horizontalCenter:
+ parent.horizontalCenter
+ text: name
+ font.bold: true
+ font.pixelSize: UIStyle.fontSizeS
+ color: UIStyle.colorQtGray1
+ }
+ Text {
+ anchors.horizontalCenter:
+ parent.horizontalCenter
+ text: date + " " + time
+ font.pixelSize: UIStyle.fontSizeXS
+ font.italic: true
+ color: UIStyle.colorQtGray2
}
}
}
}
}
}
+ }
- QQC2.PageIndicator {
- id: pgNotificationsIndicator
+ QQC2.PageIndicator {
+ id: pgNotificationsIndicator
- anchors.bottom: svNotificationsContainer.bottom
- anchors.bottomMargin: 1
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: svNotificationsContainer.bottom
+ anchors.bottomMargin: 1
+ anchors.horizontalCenter: parent.horizontalCenter
- count: svNotificationsContainer.count
- currentIndex: svNotificationsContainer.currentIndex
- }
+ count: svNotificationsContainer.count
+ currentIndex: svNotificationsContainer.currentIndex
+ }
- Component.onCompleted: {
- NotificationData.populateData(missedCallsList)
- }
+ Component.onCompleted: {
+ NotificationData.populateData(missedCallsList)
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
index 4bb944cb..0d4ebd01 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
@@ -54,290 +54,282 @@ import "../Style"
import "weather.js" as WeatherData
Item {
- Item {
- id: weatherCntr
- anchors.centerIn: parent
-
- width: UIStyle.visibleDiameter
- height: UIStyle.visibleRectHeight
+ QQC2.SwipeView {
+ id: svWeatherContainer
+
+ anchors.fill: parent
+ currentIndex: 0
+
+ Item {
+ id: weatherPage1
+
+ Row {
+ anchors.centerIn: parent
+ width: UIStyle.visibleDiameter
+ height: UIStyle.visibleRectHeight
+ padding: 20
+ spacing: 2
+
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ height: 64
+ width: 64
+ source: "images/temperature.png"
+ }
- QQC2.SwipeView {
- id: svWeatherContainer
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ height: parent.height
+ topPadding: 20
+ spacing: 40
+
+ Text {
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.temp) ?
+ qsTr("Avg: ")
+ + String(wDataCntr.weatherData.main.temp)
+ + " °F" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ Text {
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.temp_min) ?
+ qsTr("Min: ")
+ + String(wDataCntr.weatherData.main.temp_min)
+ + " °F" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ Text {
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.temp_max) ?
+ qsTr("Max: ")
+ + String(wDataCntr.weatherData.main.temp_max)
+ + " °F " : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+ }
+ }
- anchors.fill: parent
- currentIndex: 0
+ Item {
+ id: weatherPage2
- Item {
- id: weatherPage1
+ Column {
+ anchors.centerIn: parent
+ width: UIStyle.visibleRectWidth
+ height: UIStyle.visibleRectHeight
- Row {
- anchors.centerIn: parent
- width: UIStyle.visibleDiameter
- height: UIStyle.visibleRectHeight
- padding: 20
- spacing: 2
+ Item {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height / 2
+ width: parent.width
Image {
+ id: wImg
+ anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
height: 64
width: 64
- source: "images/temperature.png"
+ source: "images/wind.png"
}
- Column {
+ Text {
+ anchors.left: wImg.right
+ leftPadding: 20
anchors.verticalCenter: parent.verticalCenter
- height: parent.height
- topPadding: 20
- spacing: 40
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.wind
+ && wDataCntr.weatherData.wind.speed) ?
+ String(wDataCntr.weatherData.wind.speed)
+ + " mph" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ }
+ Item {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height / 2
+ width: parent.width
- Text {
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.temp) ?
- qsTr("Avg: ")
- + String(wDataCntr.weatherData.main.temp)
- + " °F" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
- Text {
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.temp_min) ?
- qsTr("Min: ")
- + String(wDataCntr.weatherData.main.temp_min)
- + " °F" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
- Text {
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.temp_max) ?
- qsTr("Max: ")
- + String(wDataCntr.weatherData.main.temp_max)
- + " °F " : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
+ Image {
+ id: hImg
+ anchors.left: parent.left
+ anchors.verticalCenter: parent.verticalCenter
+ height: 64
+ width: 64
+ source: "images/humidity.png"
+ }
+ Text {
+ anchors.left: hImg.right
+ leftPadding: 20
+ anchors.verticalCenter: parent.verticalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.humidity) ?
+ String(wDataCntr.weatherData.main.humidity)
+ + " %" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
}
}
}
+ }
- Item {
- id: weatherPage2
+ Item {
+ id: weatherPage3
- Column {
- anchors.centerIn: parent
- width: UIStyle.visibleRectWidth
- height: UIStyle.visibleRectHeight
+ Row {
+ anchors.centerIn: parent
+ width: UIStyle.visibleRectWidth
+ height: UIStyle.visibleRectHeight
+ spacing: 10
- Item {
- anchors.horizontalCenter: parent.horizontalCenter
- height: parent.height / 2
- width: parent.width
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ height: 64
+ width: 64
+ source: "images/pressure.png"
+ }
- Image {
- id: wImg
- anchors.left: parent.left
- anchors.verticalCenter: parent.verticalCenter
- height: 64
- width: 64
- source: "images/wind.png"
- }
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ height: parent.height
+ topPadding: 25
+ spacing: 40
- Text {
- anchors.left: wImg.right
- leftPadding: 20
- anchors.verticalCenter: parent.verticalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.wind
- && wDataCntr.weatherData.wind.speed) ?
- String(wDataCntr.weatherData.wind.speed)
- + " mph" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.pressure) ?
+ String(wDataCntr.weatherData.main.pressure)
+ + " hPa" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
}
- Item {
+ Text {
anchors.horizontalCenter: parent.horizontalCenter
- height: parent.height / 2
- width: parent.width
-
- Image {
- id: hImg
- anchors.left: parent.left
- anchors.verticalCenter: parent.verticalCenter
- height: 64
- width: 64
- source: "images/humidity.png"
- }
- Text {
- anchors.left: hImg.right
- leftPadding: 20
- anchors.verticalCenter: parent.verticalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.humidity) ?
- String(wDataCntr.weatherData.main.humidity)
- + " %" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.sea_level) ?
+ String(wDataCntr.weatherData.main.sea_level)
+ + " hPa" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
+ }
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.main
+ && wDataCntr.weatherData.main.grnd_level) ?
+ String(wDataCntr.weatherData.main.grnd_level)
+ + " hPa" : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
}
}
}
+ }
+
+ Item {
+ id: weatherPage4
- Item {
- id: weatherPage3
+ Column {
+ anchors.centerIn: parent
+ width: UIStyle.visibleDiameter
+ height: UIStyle.visibleRectHeight
- Row {
- anchors.centerIn: parent
- width: UIStyle.visibleRectWidth
- height: UIStyle.visibleRectHeight
- spacing: 10
+ Item {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height / 2
+ width: parent.width
Image {
+ anchors.left: parent.left
+ anchors.leftMargin: 30
anchors.verticalCenter: parent.verticalCenter
height: 64
width: 64
- source: "images/pressure.png"
+ source: "images/sunrise.png"
}
- Column {
+ Text {
+ anchors.right: parent.right
+ anchors.rightMargin: 30
anchors.verticalCenter: parent.verticalCenter
- height: parent.height
- topPadding: 25
- spacing: 40
-
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.pressure) ?
- String(wDataCntr.weatherData.main.pressure)
- + " hPa" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.sea_level) ?
- String(wDataCntr.weatherData.main.sea_level)
- + " hPa" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.main
- && wDataCntr.weatherData.main.grnd_level) ?
- String(wDataCntr.weatherData.main.grnd_level)
- + " hPa" : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.sys
+ && wDataCntr.weatherData.sys.sunrise) ?
+ WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunrise)
+ : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
}
}
- }
-
- Item {
- id: weatherPage4
- Column {
- anchors.centerIn: parent
- width: UIStyle.visibleDiameter
- height: UIStyle.visibleRectHeight
-
- Item {
- anchors.horizontalCenter: parent.horizontalCenter
- height: parent.height / 2
- width: parent.width
+ Item {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height / 2
+ width: parent.width
- Image {
- anchors.left: parent.left
- anchors.leftMargin: 30
- anchors.verticalCenter: parent.verticalCenter
- height: 64
- width: 64
- source: "images/sunrise.png"
- }
-
- Text {
- anchors.right: parent.right
- anchors.rightMargin: 30
- anchors.verticalCenter: parent.verticalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.sys
- && wDataCntr.weatherData.sys.sunrise) ?
- WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunrise)
- : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
+ Image {
+ anchors.left: parent.left
+ anchors.leftMargin: 30
+ anchors.verticalCenter: parent.verticalCenter
+ height: 64
+ width: 64
+ source: "images/sunset.png"
}
- Item {
- anchors.horizontalCenter: parent.horizontalCenter
- height: parent.height / 2
- width: parent.width
-
- Image {
- anchors.left: parent.left
- anchors.leftMargin: 30
- anchors.verticalCenter: parent.verticalCenter
- height: 64
- width: 64
- source: "images/sunset.png"
- }
-
- Text {
- anchors.right: parent.right
- anchors.rightMargin: 30
- anchors.verticalCenter: parent.verticalCenter
- text: (wDataCntr.weatherData
- && wDataCntr.weatherData.sys
- && wDataCntr.weatherData.sys.sunset) ?
- WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunset)
- : "N/A"
- font.pixelSize: UIStyle.fontSizeM
- font.letterSpacing: 1
- color: UIStyle.colorQtGray1
- }
+ Text {
+ anchors.right: parent.right
+ anchors.rightMargin: 30
+ anchors.verticalCenter: parent.verticalCenter
+ text: (wDataCntr.weatherData
+ && wDataCntr.weatherData.sys
+ && wDataCntr.weatherData.sys.sunset) ?
+ WeatherData.getTimeHMS(wDataCntr.weatherData.sys.sunset)
+ : "N/A"
+ font.pixelSize: UIStyle.fontSizeM
+ font.letterSpacing: 1
+ color: UIStyle.colorQtGray1
}
}
}
}
+ }
- QtObject {
- id: wDataCntr
- property var weatherData
- }
+ QtObject {
+ id: wDataCntr
+ property var weatherData
+ }
- QQC2.PageIndicator {
- id: pgWeatherIndicator
+ QQC2.PageIndicator {
+ id: pgWeatherIndicator
- anchors.bottom: svWeatherContainer.bottom
- anchors.bottomMargin: 1
- anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: svWeatherContainer.bottom
+ anchors.bottomMargin: 1
+ anchors.horizontalCenter: parent.horizontalCenter
- count: svWeatherContainer.count
- currentIndex: svWeatherContainer.currentIndex
- }
- Component.onCompleted: {
- WeatherData.requestWeatherData(wDataCntr)
- }
+ count: svWeatherContainer.count
+ currentIndex: svWeatherContainer.currentIndex
+ }
+ Component.onCompleted: {
+ WeatherData.requestWeatherData(wDataCntr)
}
}