diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml index 8a2f960..84f8e6b 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml @@ -23,12 +23,24 @@ import QtQuick 1.0 Item { id: chartEditor property variant series // TODO: rename to chart - onSeriesChanged: loader.item.chart = series; + onSeriesChanged: { + if (loader.item != undefined) + loader.item.chart = series; + } + + function selectButton(button) { + chartButton.color = "#79bd8f"; + titleButton.color = "#79bd8f"; + legendButton.color = "#79bd8f"; + axisXButton.color = "#79bd8f"; + axisYButton.color = "#79bd8f"; + button.color = "#00a388"; + } Flow { id: selectorFlow anchors.top: parent.top - height: 60 + height: 90 anchors.left: parent.left anchors.right: parent.right spacing: 5 @@ -39,11 +51,18 @@ Item { text: "Chart properties" unpressedColor: "#79bd8f" onClicked: { - color = "#00a388"; - legendButton.color = "#79bd8f"; - axisXButton.color = "#79bd8f"; - axisYButton.color = "#79bd8f"; - loader.source = "ChartEditor1.qml"; + selectButton(chartButton); + loader.source = "ChartEditorProperties.qml"; + loader.item.chart = series; + } + } + Button { + id: titleButton + text: "Title properties" + unpressedColor: "#79bd8f" + onClicked: { + selectButton(titleButton); + loader.source = "ChartEditorTitle.qml"; loader.item.chart = series; } } @@ -52,11 +71,8 @@ Item { text: "Legend properties" unpressedColor: "#79bd8f" onClicked: { - color = "#00a388"; - chartButton.color = "#79bd8f"; - axisXButton.color = "#79bd8f"; - axisYButton.color = "#79bd8f"; - loader.source = "ChartEditor2.qml"; + selectButton(legendButton); + loader.source = "ChartEditorLegend.qml"; loader.item.chartLegend = series.legend; } } @@ -65,11 +81,8 @@ Item { text: "Axis X properties" unpressedColor: "#79bd8f" onClicked: { - color = "#00a388"; - chartButton.color = "#79bd8f"; - legendButton.color = "#79bd8f"; - axisYButton.color = "#79bd8f"; - loader.source = "ChartEditor3.qml"; + selectButton(axisXButton); + loader.source = "ChartEditorAxis.qml"; loader.item.axis = series.axisX; } } @@ -78,11 +91,8 @@ Item { text: "Axis Y properties" unpressedColor: "#79bd8f" onClicked: { - color = "#00a388"; - chartButton.color = "#79bd8f"; - legendButton.color = "#79bd8f"; - axisXButton.color = "#79bd8f"; - loader.source = "ChartEditor3.qml"; + selectButton(axisYButton); + loader.source = "ChartEditorAxis.qml"; loader.item.axis = series.axisY; } } @@ -95,5 +105,4 @@ Item { anchors.left: parent.left anchors.right: parent.right } - } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor3.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml similarity index 99% rename from tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor3.qml rename to tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml index b3824ff..50eb7ce 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor3.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml @@ -26,7 +26,6 @@ Row { property variant axis Flow { - id: flow spacing: 5 flow: Flow.TopToBottom diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor2.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml similarity index 100% rename from tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor2.qml rename to tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor1.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml similarity index 96% rename from tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor1.qml rename to tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml index 285561d..69df56d 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor1.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml @@ -20,113 +20,101 @@ import QtQuick 1.0 -Row { +Flow { anchors.fill: parent - spacing: 5 property variant chart - - Flow { - flow: Flow.TopToBottom - spacing: 5 - Button { - text: "visible" - onClicked: chart.visible = !chart.visible; - } - Button { - text: "theme +" - onClicked: chart.theme++; - } - Button { - text: "theme -" - onClicked: chart.theme--; - } - Button { - text: "animation opt +" - onClicked: chart.animationOptions++; - } - Button { - text: "animation opt -" - onClicked: chart.animationOptions--; - } - Button { - text: "background color" - onClicked: chart.backgroundColor = main.nextColor(); - } - Button { - text: "drop shadow enabled" - onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled; - } - Button { - text: "zoom +" - onClicked: chart.zoom(2); - } - Button { - text: "zoom -" - onClicked: chart.zoom(0.5); - } - Button { - text: "scroll left" - onClicked: chart.scrollLeft(10); - } - Button { - text: "scroll right" - onClicked: chart.scrollRight(10); - } - Button { - text: "scroll up" - onClicked: chart.scrollUp(10); - } - Button { - text: "scroll down" - onClicked: chart.scrollDown(10); - } - Button { - text: "title color" - onClicked: chart.titleColor = main.nextColor(); - } - Button { - text: "zoom -" - onClicked: chart.zoom(0.5); - } - Button { - text: "top min margin +" - onClicked: chart.minimumMargins.top += 5; - } - Button { - text: "top min margin -" - onClicked: chart.minimumMargins.top -= 5; - } - Button { - text: "bottom min margin +" - onClicked: chart.minimumMargins.bottom += 5; - } - Button { - text: "bottom min margin -" - onClicked: chart.minimumMargins.bottom -= 5; - } - Button { - text: "left min margin +" - onClicked: chart.minimumMargins.left += 5; - } - Button { - text: "left min margin -" - onClicked: chart.minimumMargins.left -= 5; - } - Button { - text: "right min margin +" - onClicked: chart.minimumMargins.right += 5; - } - Button { - text: "right min margin -" - onClicked: chart.minimumMargins.right -= 5; - } + flow: Flow.TopToBottom + spacing: 5 + Button { + text: "visible" + onClicked: chart.visible = !chart.visible; } - - FontEditor { - id: fontEditor - fontDescription: "title" - function editedFont() { - return chart.titleFont; - } + Button { + text: "theme +" + onClicked: chart.theme++; + } + Button { + text: "theme -" + onClicked: chart.theme--; + } + Button { + text: "animation opt +" + onClicked: chart.animationOptions++; + } + Button { + text: "animation opt -" + onClicked: chart.animationOptions--; + } + Button { + text: "background color" + onClicked: chart.backgroundColor = main.nextColor(); + } + Button { + text: "drop shadow enabled" + onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled; + } + Button { + text: "zoom +" + onClicked: chart.zoom(2); + } + Button { + text: "zoom -" + onClicked: chart.zoom(0.5); + } + Button { + text: "scroll left" + onClicked: chart.scrollLeft(10); + } + Button { + text: "scroll right" + onClicked: chart.scrollRight(10); + } + Button { + text: "scroll up" + onClicked: chart.scrollUp(10); + } + Button { + text: "scroll down" + onClicked: chart.scrollDown(10); + } + Button { + text: "title color" + onClicked: chart.titleColor = main.nextColor(); + } + Button { + text: "zoom -" + onClicked: chart.zoom(0.5); + } + Button { + text: "top min margin +" + onClicked: chart.minimumMargins.top += 5; + } + Button { + text: "top min margin -" + onClicked: chart.minimumMargins.top -= 5; + } + Button { + text: "bottom min margin +" + onClicked: chart.minimumMargins.bottom += 5; + } + Button { + text: "bottom min margin -" + onClicked: chart.minimumMargins.bottom -= 5; + } + Button { + text: "left min margin +" + onClicked: chart.minimumMargins.left += 5; + } + Button { + text: "left min margin -" + onClicked: chart.minimumMargins.left -= 5; + } + Button { + text: "right min margin +" + onClicked: chart.minimumMargins.right += 5; + } + Button { + text: "right min margin -" + onClicked: chart.minimumMargins.right -= 5; } } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml new file mode 100644 index 0000000..03638f8 --- /dev/null +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the Qt Commercial Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Flow { + property variant chart + anchors.fill: parent + flow: Flow.TopToBottom + spacing: 5 + + FontEditor { + fontDescription: "title" + function editedFont() { + return chart.titleFont; + } + } +} diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml index 5532c60..984acd9 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml @@ -34,7 +34,7 @@ Flow { onClicked: editedFont().capitalization++; } Button { - text: fontDescription + " family" + text: fontDescription + " font family" onClicked: editedFont().family = "courier"; } Button { diff --git a/tests/qmlchartproperties/resources.qrc b/tests/qmlchartproperties/resources.qrc index 212c4b1..fdf8a01 100644 --- a/tests/qmlchartproperties/resources.qrc +++ b/tests/qmlchartproperties/resources.qrc @@ -18,12 +18,13 @@ qml/qmlchartproperties/PercentBarChart.qml qml/qmlchartproperties/Chart.qml qml/qmlchartproperties/ChartEditor.qml - qml/qmlchartproperties/ChartEditor1.qml - qml/qmlchartproperties/ChartEditor2.qml - qml/qmlchartproperties/ChartEditor3.qml qml/qmlchartproperties/FontEditor.qml qml/qmlchartproperties/HorizontalBarChart.qml qml/qmlchartproperties/HorizontalPercentBarChart.qml qml/qmlchartproperties/HorizontalStackedBarChart.qml + qml/qmlchartproperties/ChartEditorAxis.qml + qml/qmlchartproperties/ChartEditorLegend.qml + qml/qmlchartproperties/ChartEditorProperties.qml + qml/qmlchartproperties/ChartEditorTitle.qml