diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2014-09-12 12:51:02 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2014-10-08 17:10:29 +0200 |
commit | dbc1b4030623f6fa8e6107264ac90c74b5e5a248 (patch) | |
tree | 19c044e5c9cf322ab86b8623ed2b2dcf134ace17 | |
parent | a660ba6d2e3c56d8164058af4c0d9f19504acb47 (diff) |
Make each row in the list accessible as one item.
This also gets rid of the usage of the Repeater in order to
render the background Rectangle and MouseArea, which is nicer.
Change-Id: I0382878225f197ceaed648be45dde421610f7731
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
-rw-r--r-- | qml/pages/LongTermDayItem.qml | 39 | ||||
-rw-r--r-- | qml/pages/LongTermPage.qml | 26 |
2 files changed, 40 insertions, 25 deletions
diff --git a/qml/pages/LongTermDayItem.qml b/qml/pages/LongTermDayItem.qml index ef30e0b..6200976 100644 --- a/qml/pages/LongTermDayItem.qml +++ b/qml/pages/LongTermDayItem.qml @@ -52,14 +52,45 @@ ObjectModel { font.weight: Font.DemiBold Layout.alignment: Qt.AlignBaseline font.capitalization: Font.Capitalize + + Accessible.ignored: true + + Rectangle { + color: mouse.pressed ? ApplicationInfo.colors.smokeGray : ApplicationInfo.colors.white + width: parent.parent.width + 2* ApplicationInfo.hMargin + height: rowHeight + y: -parent.y + separator1.y + z: -1 + x: -ApplicationInfo.hMargin + Accessible.role: Accessible.Button + Accessible.name: qsTr("%1 %2 - temperature low: %3, high: %4, wind: %5 %6").arg(Utils.getDay(0, dayModel)).arg(Utils.getShortDate(dayModel.date)).arg(lowTemp.text).arg(highTemp.text).arg(windSpeed.text).arg(windSpeedUnit.text) + Accessible.description: qsTr("press for details") + MouseArea { + id: mouse + anchors.fill: parent + onClicked: { + ApplicationInfo.currentIndexDay = index + nextPage() + } + } + Rectangle { + width: parent.width + height: 1 + anchors.top: parent.top + visible: index > 0 + color: ApplicationInfo.colors.paleGray + } + } } TouchLabel { text: Utils.getShortDate(dayModel.date) pixelSize: 20 letterSpacing: -0.15 Layout.alignment: Qt.AlignBaseline + Accessible.ignored: true } Separator { + id: separator1 implicitWidth: 5 implicitHeight: 5 Layout.preferredHeight: rowHeight // sets the row height @@ -82,10 +113,12 @@ ObjectModel { Layout.minimumWidth: 5 } TouchLabel { + id: lowTemp property string temp: Utils.getMinTemp(dayModel) text: Utils.getTempFormat(temp) color: temp < 0 ? ApplicationInfo.colors.blue : ApplicationInfo.colors.doubleDarkGray Layout.alignment: Qt.AlignBaseline + Accessible.ignored: true } Rectangle { id: separator2 @@ -94,11 +127,13 @@ ObjectModel { color: ApplicationInfo.colors.lightGray } TouchLabel { + id: highTemp property int temp: Utils.getMaxTemp(dayModel) text: Utils.getTempFormat(temp) horizontalAlignment: Qt.AlignRight color: temp < 0 ? ApplicationInfo.colors.blue : ApplicationInfo.colors.doubleDarkGray Layout.alignment: Qt.AlignBaseline + Accessible.ignored: true } Separator { implicitWidth: 5 @@ -116,16 +151,20 @@ ObjectModel { visible: !isNarrow } TouchLabel { + id: windSpeed text: Utils.getWindSpeed(dayModel.afternoonIndex, dayModel) pixelSize: 24 Layout.alignment: Qt.AlignBaseline visible: !isNarrow + Accessible.ignored: true } TouchLabel { + id: windSpeedUnit //: The wind speed unit, meters per second or miles per hour text: Utils.isMetricSystem() ? qsTr("m/s") : qsTr("mph") pixelSize: 18 Layout.alignment: Qt.AlignBaseline visible: !isNarrow + Accessible.ignored: true } } diff --git a/qml/pages/LongTermPage.qml b/qml/pages/LongTermPage.qml index fde1f5b..e7f2073 100644 --- a/qml/pages/LongTermPage.qml +++ b/qml/pages/LongTermPage.qml @@ -66,33 +66,9 @@ BasicPage { width: scrollview.width implicitHeight: grid.implicitHeight property int rowHeight: ApplicationInfo.constants.rowDelegateHeight + 1 - Repeater { - id: repeater - model: cityLoaded ? ApplicationInfo.currentCityModel.daysCount() : null - Rectangle { - color: mouse.pressed ? ApplicationInfo.colors.smokeGray : ApplicationInfo.colors.white - width: scrollview.width - height: item.rowHeight - y: item.rowHeight * index - MouseArea { - id: mouse - anchors.fill: parent - onClicked: { - ApplicationInfo.currentIndexDay = index - nextPage() - } - } - Rectangle { - width: parent.width - height: 1 - anchors.bottom: parent.bottom - visible: index != (repeater.count - 1) - color: ApplicationInfo.colors.paleGray - } - } - } GridLayout { id: grid + Accessible.role: Accessible.List anchors.left: parent.left anchors.right: parent.right anchors.leftMargin: ApplicationInfo.hMargin |