diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-03-13 12:56:17 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-03-13 14:47:20 +0000 |
commit | 1f989828a9a9b02e1e20da77803fec9c7e184dda (patch) | |
tree | 5c38c0f33be1b46695eb8c19f42d30e4b1368131 /examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml | |
parent | d1ac6e3dc8b6919bcba4278a4cef8cbfa83f30a1 (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>
Diffstat (limited to 'examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml')
-rw-r--r-- | examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml | 172 |
1 files changed, 82 insertions, 90 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 } } |