From abdf3b1eaba8151f1b8e862750c38cb7a5411d2a Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 13 Aug 2012 21:31:52 +0200 Subject: make watchsimulator work again --- .../com/javispedro/sowatch/metawatch/MWLabel.qml | 2 +- .../javispedro/sowatch/metawatch/MWListView.qml | 33 ++++++++++++++++++++++ .../javispedro/sowatch/metawatch/MWSmallLabel.qml | 6 ---- .../com/javispedro/sowatch/metawatch/MWTitle.qml | 2 ++ .../qml/com/javispedro/sowatch/metawatch/qmldir | 1 - 5 files changed, 36 insertions(+), 8 deletions(-) delete mode 100644 metawatch/qml/com/javispedro/sowatch/metawatch/MWSmallLabel.qml (limited to 'metawatch/qml/com/javispedro/sowatch') diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml b/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml index d1fe507..3ce64ca 100644 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml +++ b/metawatch/qml/com/javispedro/sowatch/metawatch/MWLabel.qml @@ -2,5 +2,5 @@ import Qt 4.7 Text { font.family: "MetaWatch Large 16pt" - font.pixelSize: 16 + font.pointSize: 10.5 } diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/MWListView.qml b/metawatch/qml/com/javispedro/sowatch/metawatch/MWListView.qml index b6764b7..37b9093 100644 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/MWListView.qml +++ b/metawatch/qml/com/javispedro/sowatch/metawatch/MWListView.qml @@ -4,10 +4,13 @@ ListView { id: list property bool selectable: true + property bool indicator: true interactive: false highlightFollowsCurrentItem: false + keyNavigationWraps: false boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.VerticalFlick property real currentItemTop: currentItem !== null ? currentItem.y - contentY : 0 property real currentItemBottom: currentItem !== null ? currentItemTop + currentItem.height : 0 @@ -44,8 +47,12 @@ ListView { return; } if (currentIndex >= 0 && currentItemTop > 0) { + var prevContentY = contentY; // If the previous item is visible, highlight it decrementCurrentIndex(); + // ListView will "smoothtly scroll the list" even if hightlightFollowsCurrentItem is false, + // so we have to add the following ugly workaround: + contentY = prevContentY; } if (currentItemTop <= 0) { // If the previous item now is still not visible, scroll @@ -59,4 +66,30 @@ ListView { } } } + + Rectangle { + id: indicatorContainer + visible: list.indicator && (list.contentHeight > list.height) + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + width: 4 + + color: "white" + + Rectangle { + id: indicatorRect + + property int minHeight: 10 + + anchors.right: parent.right + anchors.left: parent.left + anchors.leftMargin: 1 + + y: (list.contentY / list.contentHeight) * indicatorContainer.height + height: Math.max(minHeight, (list.height / list.contentHeight) * indicatorContainer.height) + + color: "black" + } + } } diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/MWSmallLabel.qml b/metawatch/qml/com/javispedro/sowatch/metawatch/MWSmallLabel.qml deleted file mode 100644 index d26e058..0000000 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/MWSmallLabel.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Qt 4.7 - -Text { - font.family: "MetaWatch Large caps 8pt" - font.pixelSize: 8 -} diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml b/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml index 017d6a1..b87d535 100644 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml +++ b/metawatch/qml/com/javispedro/sowatch/metawatch/MWTitle.qml @@ -5,6 +5,7 @@ Rectangle { height: 16 property alias text: label.text + property alias font: label.font property alias icon: image Image { @@ -18,5 +19,6 @@ Rectangle { anchors.left: image.right anchors.leftMargin: 2 anchors.verticalCenter: parent.verticalCenter + font.pointSize: 12 } } diff --git a/metawatch/qml/com/javispedro/sowatch/metawatch/qmldir b/metawatch/qml/com/javispedro/sowatch/metawatch/qmldir index c6b0714..10ca498 100644 --- a/metawatch/qml/com/javispedro/sowatch/metawatch/qmldir +++ b/metawatch/qml/com/javispedro/sowatch/metawatch/qmldir @@ -1,5 +1,4 @@ MWPage 1.0 MWPage.qml MWLabel 1.0 MWLabel.qml -MWSmallLabel 1.0 MWSmallLabel.qml MWTitle 1.0 MWTitle.qml MWListView 1.0 MWListView.qml -- cgit v1.2.3