diff options
author | Tero Ahola <tero.ahola@digia.com> | 2012-06-18 11:21:23 +0300 |
---|---|---|
committer | Tero Ahola <tero.ahola@digia.com> | 2012-06-18 11:47:33 +0300 |
commit | b687c49332c3af73bfafd782fa740390fb0bc698 (patch) | |
tree | ff7e52991e86313053cbeca1f11d71f91bb5fda6 /demos/qmlchart/qml/qmlchart/main.qml | |
parent | 99b2f41bb95e2390ff645bea8375a4ee836038ef (diff) |
Documentation of QML ChartView, Axis and Legend
Diffstat (limited to 'demos/qmlchart/qml/qmlchart/main.qml')
-rw-r--r-- | demos/qmlchart/qml/qmlchart/main.qml | 96 |
1 files changed, 49 insertions, 47 deletions
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; + } } |