From b687c49332c3af73bfafd782fa740390fb0bc698 Mon Sep 17 00:00:00 2001 From: Tero Ahola Date: Mon, 18 Jun 2012 11:21:23 +0300 Subject: Documentation of QML ChartView, Axis and Legend --- demos/qmlchart/qml/qmlchart/main.qml | 96 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 47 deletions(-) (limited to 'demos/qmlchart/qml/qmlchart/main.qml') diff --git a/demos/qmlchart/qml/qmlchart/main.qml b/demos/qmlchart/qml/qmlchart/main.qml index 09e2feca..e5307867 100644 --- a/demos/qmlchart/qml/qmlchart/main.qml +++ b/demos/qmlchart/qml/qmlchart/main.qml @@ -28,61 +28,63 @@ Rectangle { Loader { id: loader - anchors.top: parent.top - anchors.bottom: buttons.top - anchors.left: parent.left - anchors.right: parent.right + anchors.fill: parent source: "View" + viewNumber + ".qml"; } - Row { - id: buttons - anchors.bottom: parent.bottom - anchors.bottomMargin: 15 - anchors.horizontalCenter: parent.horizontalCenter - spacing: 5 + Rectangle { + id: infoText + anchors.centerIn: parent + width: parent.width + height: 40 + color: "black" + Text { + color: "white" + anchors.centerIn: parent + text: "Use left and right arrow keys to navigate between chart types" + } - Rectangle { - height: 35 - width: 60 - border.color: "#c8955c" - border.width: 2 - radius: 5 - Text { - anchors.centerIn: parent - text: "<" - } - MouseArea { - anchors.fill: parent - onClicked: { - var i = viewNumber - 1; - if (i <= 0) - viewNumber = 9; - else - viewNumber = i; - } - } + Behavior on opacity { + NumberAnimation { duration: 400 } } - Rectangle { - height: 35 - width: 60 - border.color: "#c8955c" - border.width: 2 - radius: 5 - Text { - anchors.centerIn: parent - text: ">" + } + + MouseArea { + focus: true + anchors.fill: parent + onClicked: { + if (infoText.opacity > 0) { + infoText.opacity = 0.0; + } else { + nextView(); } - MouseArea { - anchors.fill: parent - onClicked: { - var i = viewNumber + 1; - if (i > 9) - viewNumber = 1; - else - viewNumber = i; + } + Keys.onPressed: { + if (infoText.opacity > 0) { + infoText.opacity = 0.0; + } else { + if (event.key == Qt.Key_Left) { + previousView(); + } else { + nextView(); } } } } + + function nextView() { + var i = viewNumber + 1; + if (i > 9) + viewNumber = 1; + else + viewNumber = i; + } + + function previousView() { + var i = viewNumber - 1; + if (i <= 0) + viewNumber = 9; + else + viewNumber = i; + } } -- cgit v1.2.3