diff options
Diffstat (limited to 'tests')
186 files changed, 1609 insertions, 3947 deletions
diff --git a/tests/auto/auto.pri b/tests/auto/auto.pri index c528b34a..a0915009 100644 --- a/tests/auto/auto.pri +++ b/tests/auto/auto.pri @@ -2,26 +2,14 @@ error( "Couldn't find the tests.pri file!" ) } -greaterThan(QT_MAJOR_VERSION, 4) { QT += testlib widgets -} else { - CONFIG += qtestlib -} -!contains(TARGET, ^tst_.*):TARGET = $$join(TARGET,,"tst_") -android { - # Workaround to fix android deployment, which seems to always look for target in - # OUT_PWD instead of DESTDIR. Need to override the QMAKE_POST_LINK setting done - # in tests.pri, as "tst_" was prepended to the target. - COPY_PARAMETERS = "$$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so" - contains(QMAKE_HOST.os, Windows): COPY_PARAMETERS = $$replace(COPY_PARAMETERS, "/","\\") - QMAKE_POST_LINK += $$QMAKE_COPY $$COPY_PARAMETERS -} +!contains(TARGET, ^tst_.*):TARGET = $$join(TARGET,,"tst_") INCLUDEPATH += ../inc HEADERS += ../inc/tst_definitions.h -OBJECTS_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET -MOC_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET -UI_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET -RCC_DIR = $$CHART_BUILD_DIR/tests/auto/$$TARGET +#Define for unit tests +CONFIG(debug, debug|release) { + DEFINES += BUILD_PRIVATE_UNIT_TESTS +} diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 416b2372..32d49fa4 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -1,7 +1,3 @@ -!include( ../tests.pri ) { - error( "Couldn't find the tests.pri file!" ) -} - TEMPLATE = subdirs SUBDIRS += \ qchartview \ @@ -28,27 +24,12 @@ SUBDIRS += \ chartdataset \ qlegend -contains(QT_VERSION, ^4\\.[0-7]\\.[0-3]\\s*$) | contains(QT_VERSION, ^4\\.[0-6]\\..*) { - warning("QtCommercial.Charts QML API requires at least Qt 4.7.4. You are using $${QT_VERSION} so the QML API is disabled.") -} else { - !contains(QT_VERSION, ^5\\..*\\..*$)|qtHaveModule(declarative): SUBDIRS += qml - - # Check if QtQuickTest is installed - exists($$(QTDIR)/mkspecs/features/qmltestcase.prf){ - SUBDIRS += qml-qtquicktest - } else { - warning("QtQuickTest not found; cannot build QML api unit tests") - } -} - !linux-arm*: { SUBDIRS += \ qdatetimeaxis } -contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) { - SUBDIRS += quick2 +qtHaveModule(quick) { + SUBDIRS += qml \ + qml-qtquicktest } - - - diff --git a/tests/auto/chartdataset/chartdataset.pro b/tests/auto/chartdataset/chartdataset.pro index 9a7880de..994532ae 100644 --- a/tests/auto/chartdataset/chartdataset.pro +++ b/tests/auto/chartdataset/chartdataset.pro @@ -2,4 +2,6 @@ error( "Couldn't find the auto.pri file!" ) } +QT += charts-private + SOURCES += tst_chartdataset.cpp diff --git a/tests/auto/chartdataset/tst_chartdataset.cpp b/tests/auto/chartdataset/tst_chartdataset.cpp index 4bd1441e..2a0f9637 100644 --- a/tests/auto/chartdataset/tst_chartdataset.cpp +++ b/tests/auto/chartdataset/tst_chartdataset.cpp @@ -31,11 +31,7 @@ private Q_SLOTS: void tst_ChartDataSet::skip() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QSKIP("This test requires the debug version of library"); -#else - QSKIP("This test requires the debug version of library", SkipAll); -#endif } QTEST_MAIN(tst_ChartDataSet) @@ -63,7 +59,7 @@ QTEST_MAIN(tst_ChartDataSet) #include <private/abstractdomain_p.h> #include <tst_definitions.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(AbstractDomain *) Q_DECLARE_METATYPE(QAbstractAxis *) diff --git a/tests/auto/domain/domain.pro b/tests/auto/domain/domain.pro index 8c9af3d7..f0e90136 100644 --- a/tests/auto/domain/domain.pro +++ b/tests/auto/domain/domain.pro @@ -2,4 +2,6 @@ error( "Couldn't find the auto.pri file!" ) } +QT += charts-private + SOURCES += tst_domain.cpp diff --git a/tests/auto/domain/tst_domain.cpp b/tests/auto/domain/tst_domain.cpp index d9c853b4..33b68a10 100644 --- a/tests/auto/domain/tst_domain.cpp +++ b/tests/auto/domain/tst_domain.cpp @@ -32,11 +32,7 @@ private Q_SLOTS: void tst_Domain::skip() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QSKIP("This test requires the debug version of library"); -#else - QSKIP("This test requires the debug version of library", SkipAll); -#endif } QTEST_MAIN(tst_Domain) @@ -49,7 +45,7 @@ QTEST_MAIN(tst_Domain) #include <private/qabstractaxis_p.h> #include <tst_definitions.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(XYDomain*) Q_DECLARE_METATYPE(QSizeF) diff --git a/tests/auto/inc/tst_definitions.h b/tests/auto/inc/tst_definitions.h index 12963e78..6dd4a837 100644 --- a/tests/auto/inc/tst_definitions.h +++ b/tests/auto/inc/tst_definitions.h @@ -21,11 +21,10 @@ #ifndef TST_DEFINITIONS_H #define TST_DEFINITIONS_H -#include "qpolarchart.h" +#include <QtCharts/qpolarchart.h> #include <QtTest/QtTest> #include <QPushButton> -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) namespace QTest { // This was deprecated in Qt5. This is a small hack for the sake of compatibility. @@ -34,7 +33,6 @@ namespace QTest return QTest::qWaitForWindowExposed(window); } } -#endif #define TRY_COMPARE(actual, expected) { \ do { \ @@ -51,7 +49,6 @@ namespace QTest // Some bamboo clients have trouble passing mouse events to the test application. // This can be used to skip those tests so that they don't show up as a failure // in the test report. -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \ do { \ QPushButton b; \ @@ -74,30 +71,6 @@ namespace QTest if (!isPolarTest()) \ QSKIP("Test not supported by cartesian chart"); \ } -#else - #define SKIP_IF_CANNOT_TEST_MOUSE_EVENTS() { \ - do { \ - QPushButton b; \ - b.resize(100, 100); \ - b.show(); \ - QTest::qWaitForWindowShown(&b); \ - QSignalSpy spy(&b, SIGNAL(clicked())); \ - QTest::mouseClick(&b, Qt::LeftButton, 0, b.rect().center()); \ - if (spy.count() == 0) \ - QSKIP("Cannot test mouse events in this environment", SkipAll); \ - } while (0); \ - } - - #define SKIP_ON_POLAR() { \ - if (isPolarTest()) \ - QSKIP("Test not supported by polar chart", SkipAll); \ - } - - #define SKIP_ON_CARTESIAN() { \ - if (!isPolarTest()) \ - QSKIP("Test not supported by cartesian chart", SkipAll); \ - } -#endif static inline bool isPolarTest() { @@ -112,12 +85,12 @@ static inline bool isPolarTest() return isPolar; } -static inline QtCommercialChart::QChart *newQChartOrQPolarChart() +static inline QtCharts::QChart *newQChartOrQPolarChart() { if (isPolarTest()) - return new QtCommercialChart::QPolarChart(); + return new QtCharts::QPolarChart(); else - return new QtCommercialChart::QChart(); + return new QtCharts::QChart(); } diff --git a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp index d9cbebd4..4df20372 100644 --- a/tests/auto/qabstractaxis/tst_qabstractaxis.cpp +++ b/tests/auto/qabstractaxis/tst_qabstractaxis.cpp @@ -135,11 +135,7 @@ void tst_QAbstractAxis::axisPenColor_data() void tst_QAbstractAxis::axisPenColor() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QSKIP("Test is not implemented. This is deprecated function"); -#else - QSKIP("Test is not implemented. This is deprecated function", SkipAll); -#endif } void tst_QAbstractAxis::gridLinePen_data() @@ -404,11 +400,7 @@ void tst_QAbstractAxis::labelsColor_data() void tst_QAbstractAxis::labelsColor() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QSKIP("Test is not implemented. This is deprecated function"); -#else - QSKIP("Test is not implemented. This is deprecated function", SkipAll); -#endif } void tst_QAbstractAxis::labelsFont_data() @@ -633,11 +625,7 @@ void tst_QAbstractAxis::shadesBorderColor_data() void tst_QAbstractAxis::shadesBorderColor() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QSKIP("Test is not implemented. This is deprecated function"); -#else - QSKIP("Test is not implemented. This is deprecated function", SkipAll); -#endif } void tst_QAbstractAxis::shadesBrush_data() @@ -687,11 +675,7 @@ void tst_QAbstractAxis::shadesColor_data() // public QColor shadesColor() const void tst_QAbstractAxis::shadesColor() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QSKIP("Test is not implemented. This is deprecated function"); -#else - QSKIP("Test is not implemented. This is deprecated function", SkipAll); -#endif } void tst_QAbstractAxis::shadesPen_data() diff --git a/tests/auto/qabstractaxis/tst_qabstractaxis.h b/tests/auto/qabstractaxis/tst_qabstractaxis.h index 8e9d1b27..2ca5107a 100644 --- a/tests/auto/qabstractaxis/tst_qabstractaxis.h +++ b/tests/auto/qabstractaxis/tst_qabstractaxis.h @@ -26,7 +26,7 @@ #include <qabstractaxis.h> #include <qchartview.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_QAbstractAxis : public QObject { diff --git a/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp b/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp index 3fc51f8f..0e9fef5a 100644 --- a/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp +++ b/tests/auto/qbarmodelmapper/tst_qbarmodelmapper.cpp @@ -29,7 +29,7 @@ #include <qhbarmodelmapper.h> #include <QStandardItemModel> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_qbarmodelmapper : public QObject { diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp index f2c056a0..c9265e38 100644 --- a/tests/auto/qbarseries/tst_qbarseries.cpp +++ b/tests/auto/qbarseries/tst_qbarseries.cpp @@ -25,7 +25,7 @@ #include <qchart.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QBarSet*) Q_DECLARE_METATYPE(QList<QBarSet*>) diff --git a/tests/auto/qbarset/tst_qbarset.cpp b/tests/auto/qbarset/tst_qbarset.cpp index 74db42f0..4c937dce 100644 --- a/tests/auto/qbarset/tst_qbarset.cpp +++ b/tests/auto/qbarset/tst_qbarset.cpp @@ -24,7 +24,7 @@ #include <qchartview.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_QBarSet : public QObject { diff --git a/tests/auto/qchart/tst_qchart.cpp b/tests/auto/qchart/tst_qchart.cpp index 54cd5621..18ae868c 100644 --- a/tests/auto/qchart/tst_qchart.cpp +++ b/tests/auto/qchart/tst_qchart.cpp @@ -33,7 +33,7 @@ #include <qbarcategoryaxis.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QAbstractAxis *) Q_DECLARE_METATYPE(QValueAxis *) diff --git a/tests/auto/qchartview/tst_qchartview.cpp b/tests/auto/qchartview/tst_qchartview.cpp index ab404370..f8264bad 100644 --- a/tests/auto/qchartview/tst_qchartview.cpp +++ b/tests/auto/qchartview/tst_qchartview.cpp @@ -19,13 +19,13 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <qchartview.h> -#include <qlineseries.h> +#include <QtCharts/qchartview.h> +#include <QtCharts/qlineseries.h> #include <cmath> #include <tst_definitions.h> -#include <qvalueaxis.h> +#include <QtCharts/qvalueaxis.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QChart*) diff --git a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp index de5b868f..5294ff2c 100644 --- a/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp +++ b/tests/auto/qhorizontalbarseries/tst_qhorizontalbarseries.cpp @@ -25,7 +25,7 @@ #include <qchart.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QBarSet*) Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition) diff --git a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp index e03f0d0e..63afbb2a 100644 --- a/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp +++ b/tests/auto/qhorizontalpercentbarseries/tst_qhorizontalpercentbarseries.cpp @@ -25,7 +25,7 @@ #include <qchart.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QBarSet*) Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition) diff --git a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp index b25df764..df4f0837 100644 --- a/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp +++ b/tests/auto/qhorizontalstackedbarseries/tst_qhorizontalstackedbarseries.cpp @@ -25,7 +25,7 @@ #include <qchart.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QBarSet*) Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition) diff --git a/tests/auto/qlegend/tst_qlegend.cpp b/tests/auto/qlegend/tst_qlegend.cpp index a4899a5e..7f14a43a 100644 --- a/tests/auto/qlegend/tst_qlegend.cpp +++ b/tests/auto/qlegend/tst_qlegend.cpp @@ -33,7 +33,7 @@ #include <qbarlegendmarker.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_QLegend : public QObject { diff --git a/tests/auto/qml-qtquicktest/qml-qtquicktest.pro b/tests/auto/qml-qtquicktest/qml-qtquicktest.pro index 94062270..d9a1e74f 100644 --- a/tests/auto/qml-qtquicktest/qml-qtquicktest.pro +++ b/tests/auto/qml-qtquicktest/qml-qtquicktest.pro @@ -2,12 +2,8 @@ error( "Couldn't find the auto.pri file!" ) } -greaterThan(QT_MAJOR_VERSION, 4) { - TEMPLATE = app - CONFIG += warn_on qmltestcase - SOURCES += main.cpp - OTHER_FILES += tst_*.qml - DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" -} else { - error("These auto tests are designed for Qt5 / QtQuick 2.0") -} +TEMPLATE = app +CONFIG += warn_on qmltestcase +SOURCES += main.cpp +OTHER_FILES += tst_*.qml +DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml index eae2364a..f936237c 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml +++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 @@ -87,7 +87,7 @@ Rectangle { id: axisX categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ] } - axisY: ValuesAxis { + axisY: ValueAxis { id: axisY min: 0 max: 10 diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml index 6e21b990..e3f55b13 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml index d40c407c..61b35443 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml index 7b714ad5..aced30ac 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml new file mode 100644 index 00000000..96d23b34 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest BarCategoryAxis 1.4" + when: windowShown + + function test_minMax() { + compare(barSeries1.axisX.min, "Jan", "AxisX min"); + compare(barSeries1.axisX.max, "Jun", "AxisX max"); + compare(barSeries1.axisY.min, 0, "AxisY min"); + compare(barSeries1.axisY.max, 10, "AxisY max"); + } + + function test_categories() { + compare(barSeries1.axisX.count, 6, "AxisX count"); + categoriesCountChangedSpy.clear(); + categoriesChangedSpy.clear(); + + // Replace categories + barSeries1.axisX.categories = ["Tam", "Hel", "Maa", "Huh"]; + compare(barSeries1.axisX.count, 4, "AxisX count"); + compare(categoriesCountChangedSpy.count, 1, "onCountChanged"); + compare(categoriesChangedSpy.count, 1, "onCategoriesChanged"); + + // Reset the original categories + barSeries1.axisX.categories = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] + compare(barSeries1.axisX.count, 6, "AxisX count"); + compare(categoriesCountChangedSpy.count, 2, "onCountChanged"); + compare(categoriesChangedSpy.count, 2, "onCategoriesChanged"); + } + + function test_minMaxChanged() { + axisY.min = -1; + compare(minChangedSpy.count, 1, "onMinChanged"); + compare(maxChangedSpy.count, 0, "onMaxChanged"); + axisY.max = 12; + compare(minChangedSpy.count, 1, "onMinChanged"); + compare(maxChangedSpy.count, 1, "onMaxChanged"); + } + + function test_seriesAxisClear() { + verify(barSeries1.axisX.min !== "", "barSeries1.axisX.min"); + verify(barSeries1.axisX.max !== "", "barSeries1.axisX.max"); + verify(barSeries1.axisX.count !== 0, "barSeries1.axisX.count"); // category count + barSeries1.axisX.clear(); + verify(barSeries1.axisX.min === "", "barSeries1.axisX.min"); + verify(barSeries1.axisX.max === "", "barSeries1.axisX.max"); + verify(barSeries1.axisX.count === 0); + } + + } + + ChartView { + id: chartView + anchors.fill: parent + + BarSeries { + id: barSeries1 + axisX: BarCategoryAxis { + id: axisX + categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ] + } + axisY: ValueAxis { + id: axisY + min: 0 + max: 10 + } + } + + SignalSpy { + id: categoriesCountChangedSpy + target: axisX + signalName: "countChanged" + } + SignalSpy { + id: categoriesChangedSpy + target: axisX + signalName: "categoriesChanged" + } + SignalSpy { + id: minChangedSpy + target: axisY + signalName: "minChanged" + } + SignalSpy { + id: maxChangedSpy + target: axisY + signalName: "maxChanged" + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_barseries.qml b/tests/auto/qml-qtquicktest/tst_barseries.qml index c5a5cfb7..fb80a744 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries.qml +++ b/tests/auto/qml-qtquicktest/tst_barseries.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml index 5253019c..b2d1c199 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml index d4c2d878..8c859596 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml index bcc7ac15..4f9ae5fc 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml new file mode 100644 index 00000000..0a2607dd --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest BarSeries 1.4" + when: windowShown + + function test_properties() { + compare(barSeries.barWidth, 0.5); + compare(barSeries.labelsVisible, false); + compare(barSeries.labelsPosition, BarSeries.LabelsCenter); + } + + function test_setproperties() { + var set = barSeries.append("property", [1, 2, 3]) + compare(set.brushFilename, ""); + } + + function test_axes() { + verify(chartView.axisX() == barSeries.axisX); + verify(chartView.axisY() == barSeries.axisY); + + compare(barSeries.axisX, stackedBarSeries.axisX); + compare(barSeries.axisY, stackedBarSeries.axisY); + + compare(barSeries.axisX, percentBarSeries.axisX); + compare(barSeries.axisY, percentBarSeries.axisY); + } + + function test_append() { + var setCount = 5; + var valueCount = 50; + addedSpy.clear(); + append(setCount, valueCount); + + compare(barSeries.count, setCount); + for (var k = 0; k < setCount; k++) { + compare(barSeries.at(k).count, valueCount); + compare(barSeries.at(k).label, "barset" + k); + } + compare(addedSpy.count, setCount); + + barSeries.clear(); + compare(barSeries.count, 0); + } + + function test_insert() { + var setCount = 5; + var valueCount = 50; + addedSpy.clear(); + append(setCount, valueCount); + + for (var i = 0; i < setCount; i++) { + var values = []; + for (var j = 0; j < valueCount; j++) + values[j] = Math.random() * 10; + var set = barSeries.insert(i, "barset" + i, values); + compare(set.label, "barset" + i); + } + + compare(barSeries.count, setCount * 2); + for (var k = 0; k < setCount * 2; k++) + compare(barSeries.at(k).count, valueCount); + compare(addedSpy.count, 2 * setCount); + + barSeries.clear(); + compare(barSeries.count, 0); + } + + function test_signals() { + labelsPositionSpy.clear(); + barSeries.labelsPosition = BarSeries.LabelsOutsideEnd; + compare(labelsPositionSpy.count, 1, "onLabelsPositionChanged") + } + + function test_remove() { + var setCount = 5; + var valueCount = 50; + removedSpy.clear(); + append(setCount, valueCount); + + for (var k = 0; k < setCount; k++) + barSeries.remove(barSeries.at(0)); + + compare(barSeries.count, 0); + compare(removedSpy.count, setCount); + } + + // Not a test function, used by one or more test functions + function append(setCount, valueCount) { + for (var i = 0; i < setCount; i++) { + var values = []; + for (var j = 0; j < valueCount; j++) + values[j] = Math.random() * 10; + barSeries.append("barset" + i, values); + } + } + } + + ChartView { + id: chartView + anchors.fill: parent + + BarSeries { + id: barSeries + name: "bar" + axisX: BarCategoryAxis {} + axisY: ValueAxis { min: 0; max: 10 } + + SignalSpy { + id: addedSpy + target: barSeries + signalName: "barsetsAdded" + } + SignalSpy { + id: removedSpy + target: barSeries + signalName: "barsetsRemoved" + } + SignalSpy { + id: labelsPositionSpy + target: barSeries + signalName: "labelsPositionChanged" + } + } + + StackedBarSeries { + id: stackedBarSeries + name: "stackedBar" + } + + PercentBarSeries { + id: percentBarSeries + name: "percentBar" + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries.qml index 22a6e1bf..860f3a80 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml +++ b/tests/auto/qml-qtquicktest/tst_boxplotseries.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml index 78c187eb..84ca79b2 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml new file mode 100644 index 00000000..bd4adc20 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest BoxPlotSeries 1.4" + when: windowShown + + function test_properties() { + compare(boxPlotSeries.boxWidth, 0.5); + compare(boxPlotSeries.brushFilename, ""); + } + + function test_setproperties() { + var set = boxPlotSeries.append("boxplot", [1, 2, 5, 6, 8]); + compare(set.label, "boxplot"); + compare(set.count, 5); + compare(set.brushFilename, ""); + } + + function test_append() { + boxPlotSeries.clear(); + addedSpy.clear(); + countChangedSpy.clear(); + var count = 50; + for (var i = 0; i < count; i++) + boxPlotSeries.append("boxplot" + i, Math.random()); + compare(addedSpy.count, count); + compare(countChangedSpy.count, count); + compare(boxPlotSeries.count, count) + boxPlotSeries.clear(); + } + + function test_remove() { + boxPlotSeries.clear(); + removedSpy.clear(); + countChangedSpy.clear(); + var count = 50; + for (var i = 0; i < count; i++) + boxPlotSeries.append("boxplot" + i, Math.random()); + for (var j = 0; j < count; j++) + boxPlotSeries.remove(boxPlotSeries.at(0)); + compare(removedSpy.count, count); + compare(countChangedSpy.count, 2 * count); + compare(boxPlotSeries.count, 0) + } + } + + ChartView { + id: chartView + anchors.fill: parent + + BoxPlotSeries { + id: boxPlotSeries + name: "boxplot" + BoxSet { label: "Jan"; values: [3, 4, 5.1, 6.2, 8.5] } + + SignalSpy { + id: addedSpy + target: boxPlotSeries + signalName: "boxsetsAdded" + } + SignalSpy { + id: removedSpy + target: boxPlotSeries + signalName: "boxsetsRemoved" + } + SignalSpy { + id: countChangedSpy + target: boxPlotSeries + signalName: "countChanged" + } + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis.qml index 5248eeb6..a19c59ae 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis.qml +++ b/tests/auto/qml-qtquicktest/tst_categoryaxis.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 @@ -53,7 +53,7 @@ Rectangle { LineSeries { id: lineSeries1 - axisX: ValuesAxis { + axisX: ValueAxis { id: axisX min: 0 max: 10 diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml index 8b10ad9b..1e865fb3 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml index f29b04b2..019fa667 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml index 9fbb0b2a..a3899285 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml new file mode 100644 index 00000000..196aec9d --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest CategoryAxis 1.4" + when: windowShown + + function test_minMax() { + compare(lineSeries1.axisX.min, 0, "AxisX min"); + compare(lineSeries1.axisX.max, 10, "AxisX max"); + compare(lineSeries1.axisY.min, 0, "AxisY min"); + compare(lineSeries1.axisY.max, 10, "AxisY max"); + } + + function test_categories() { + compare(lineSeries1.axisY.startValue, 0, "AxisY start value"); + compare(lineSeries1.axisY.count, 3, "AxisY count"); + compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels"); + compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels"); + compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels"); + } + } + + ChartView { + id: chartView + anchors.fill: parent + + LineSeries { + id: lineSeries1 + axisX: ValueAxis { + id: axisX + min: 0 + max: 10 + } + axisY: CategoryAxis { + id: axisY + min: 0 + max: 10 + startValue: 0 + CategoryRange { + label: "label0" + endValue: 1 + } + CategoryRange { + label: "label1" + endValue: 3 + } + CategoryRange { + label: "label2" + endValue: 10 + } + } + XYPoint { x: -1; y: -1 } + XYPoint { x: 0; y: 0 } + XYPoint { x: 5; y: 5 } + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_chartview.qml b/tests/auto/qml-qtquicktest/tst_chartview.qml index 5b530e73..31e6775b 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview.qml +++ b/tests/auto/qml-qtquicktest/tst_chartview.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml index a31372be..67e0732f 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml index 8a44a58e..3d9dcb5f 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml index e2378999..1ed2c6a2 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml b/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml new file mode 100644 index 00000000..d3e032f3 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest ChartView Properties 1.4" + when: windowShown + + function test_chartViewProperties() { + compare(chartView.animationOptions, ChartView.NoAnimation, "ChartView.animationOptions"); + verify(chartView.backgroundColor != undefined); + verify(chartView.margins.bottom > 0, "ChartView.margins.bottom"); + verify(chartView.margins.top > 0, "ChartView.margins.top"); + verify(chartView.margins.left > 0, "ChartView.margins.left"); + verify(chartView.margins.right > 0, "ChartView.margins.right"); + compare(chartView.count, 0, "ChartView.count"); + compare(chartView.dropShadowEnabled, false, "ChartView.dropShadowEnabled"); + verify(chartView.plotArea.height > 0, "ChartView.plotArea.height"); + verify(chartView.plotArea.width > 0, "ChartView.plotArea.width"); + verify(chartView.plotArea.x > 0, "ChartView.plotArea.x"); + verify(chartView.plotArea.y > 0, "ChartView.plotArea.y"); + compare(chartView.theme, ChartView.ChartThemeLight, "ChartView.theme"); + compare(chartView.title, "", "ChartView.title"); + compare(chartView.title, "", "ChartView.title"); + verify(chartView.titleColor != undefined, "ChartView.titleColor"); + compare(chartView.titleFont.bold, false, "ChartView.titleFont.bold"); + // Legend + compare(chartView.legend.visible, true, "ChartView.legend.visible"); + compare(chartView.legend.alignment, Qt.AlignTop, "ChartView.legend.alignment"); + compare(chartView.legend.backgroundVisible, false, "ChartView.legend.backgroundVisible"); + verify(chartView.legend.borderColor != undefined, "ChartView.legend.borderColor"); + verify(chartView.legend.color != undefined, "ChartView.legend.color"); + compare(chartView.legend.reverseMarkers, false, "ChartView.legend.reverseMarkers"); + // Legend font + compare(chartView.legend.font.bold, false, "ChartView.legend.font.bold"); + compare(chartView.legend.font.capitalization, Font.MixedCase, "ChartView.legend.font.capitalization"); + verify(chartView.legend.font.family != "", "ChartView.legend.font.family"); + compare(chartView.legend.font.italic, false, "ChartView.legend.font.italic"); + compare(chartView.legend.font.letterSpacing, 0.0, "ChartView.legend.font.letterSpacing"); + verify(chartView.legend.font.pixelSize > 0 + && chartView.legend.font.pixelSize < 50, "ChartView.legend.font.pixelSize"); + verify(chartView.legend.font.pointSize > 0 + && chartView.legend.font.pointSize < 50, "ChartView.legend.font.pointSize"); + compare(chartView.legend.font.strikeout, false, "ChartView.legend.font.strikeout"); + compare(chartView.legend.font.underline, false, "ChartView.legend.font.underline"); + compare(chartView.legend.font.weight, Font.Normal, "ChartView.legend.font.weight"); + compare(chartView.legend.font.wordSpacing, 0.0, "ChartView.legend.font.wordSpacing"); + } + } + + ChartView { + id: chartView + anchors.fill: parent + } +} diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml index 6c694bd5..2fca5639 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml index 5f26d7d7..d25d8b73 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml index 7e7c1115..9e1e8fda 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml index b56ec21d..a259d2b4 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml new file mode 100644 index 00000000..36745a73 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest ChartView Functions 1.4" + when: windowShown + + function test_chartViewSeriesAndAxes() { + // Create XY series + var line = chartView.createSeries(ChartView.SeriesTypeLine, "line"); + verify(line != null && line != undefined); + var spline = chartView.createSeries(ChartView.SeriesTypeSpline, "spline"); + verify(spline != null && spline != undefined); + var scatter = chartView.createSeries(ChartView.SeriesTypeScatter, "scatter"); + verify(scatter != null && scatter != undefined); + + // Create a series with specific axes + var line2 = chartView.createSeries(ChartView.SeriesTypeLine, "line2", chartView.axisX(line), chartView.axisY(line)); + + // Check that all the XY series use the same axes + verify(chartView.axisX(line) != null); + verify(chartView.axisY(line) != null); + compare(chartView.axisX(line), chartView.axisX(line2)); + compare(chartView.axisY(line), chartView.axisY(line2)); + compare(chartView.axisX(line), chartView.axisX(spline)); + compare(chartView.axisY(line), chartView.axisY(spline)); + compare(chartView.axisX(line), chartView.axisX(scatter)); + compare(chartView.axisY(line), chartView.axisY(scatter)); + + var bar = chartView.createSeries(ChartView.SeriesTypeBar, "bar"); + verify(bar != null && bar != undefined); + var stackedbar = chartView.createSeries(ChartView.SeriesTypeStackedBar, "stackedbar"); + verify(stackedbar != null && stackedbar != undefined); + var percentbar = chartView.createSeries(ChartView.SeriesTypePercentBar, "percentbar"); + verify(percentbar != null && percentbar != undefined); + var horizontalbar = chartView.createSeries(ChartView.SeriesTypeHorizontalBar, "horizontalbar"); + verify(horizontalbar != null && horizontalbar != undefined); + var horizontalstackedbar = chartView.createSeries(ChartView.SeriesTypeHorizontalStackedBar, "horizontalstackedbar"); + verify(horizontalstackedbar != null && horizontalstackedbar != undefined); + var horizontalpercentbar = chartView.createSeries(ChartView.SeriesTypeHorizontalPercentBar, "horizontalpercentbar"); + verify(horizontalpercentbar != null && horizontalpercentbar != undefined); + var area = chartView.createSeries(ChartView.SeriesTypeArea, "area"); + verify(area != null && area != undefined); + + // Remove all series + chartView.removeAllSeries(); + compare(chartView.count, 0); + } + + function test_chartViewRange() { + // Set initial values + chartView.createSeries(ChartView.SeriesTypeLine, "line"); + verify(chartView.axisX() != null); + verify(chartView.axisY() != null); + chartView.axisX().min = 1.0; + chartView.axisX().max = 2.0; + chartView.axisY().min = 1.0; + chartView.axisY().max = 2.0; + + var xMax = chartView.axisX().max; + var xMin = chartView.axisX().min; + var yMax = chartView.axisY().max; + var yMin = chartView.axisY().min; + + // zoom x 2.5 + chartView.zoom(1.5); + verify(chartView.axisX().max < xMax); + verify(chartView.axisX().min > xMin); + verify(chartView.axisY().max < yMax); + verify(chartView.axisY().min > yMin); + xMax = chartView.axisX().max; + xMin = chartView.axisX().min; + yMax = chartView.axisY().max; + yMin = chartView.axisY().min; + + // zoom x 0.5 + chartView.zoom(0.5); + verify(chartView.axisX().max > xMax); + verify(chartView.axisX().min < xMin); + verify(chartView.axisY().max > yMax); + verify(chartView.axisY().min < yMin); + xMax = chartView.axisX().max; + xMin = chartView.axisX().min; + yMax = chartView.axisY().max; + yMin = chartView.axisY().min; + + // Scroll up + chartView.scrollUp(10); + compare(chartView.axisX().max, xMax); + compare(chartView.axisX().min, xMin); + verify(chartView.axisY().max > yMax); + verify(chartView.axisY().min > yMin); + xMax = chartView.axisX().max; + xMin = chartView.axisX().min; + yMax = chartView.axisY().max; + yMin = chartView.axisY().min; + + // Scroll down + chartView.scrollDown(10); + compare(chartView.axisX().max, xMax); + compare(chartView.axisX().min, xMin); + verify(chartView.axisY().max < yMax); + verify(chartView.axisY().min < yMin); + xMax = chartView.axisX().max; + xMin = chartView.axisX().min; + yMax = chartView.axisY().max; + yMin = chartView.axisY().min; + + // Scroll left + chartView.scrollLeft(10); + verify(chartView.axisX().max < xMax); + verify(chartView.axisX().min < xMin); + compare(chartView.axisY().max, yMax); + compare(chartView.axisY().min, yMin); + xMax = chartView.axisX().max; + xMin = chartView.axisX().min; + yMax = chartView.axisY().max; + yMin = chartView.axisY().min; + + // Scroll right + chartView.scrollRight(10); + verify(chartView.axisX().max > xMax); + verify(chartView.axisX().min > xMin); + compare(chartView.axisY().max, yMax); + compare(chartView.axisY().min, yMin); + } + } + + ChartView { + id: chartView + anchors.fill: parent + title: "Chart" + } +} diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml index db9df5c0..8085bef2 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml index a6bab95d..0dcefeb4 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml index 46c0adcb..954740cf 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml index 66261b39..a4f01c32 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml new file mode 100644 index 00000000..db93c519 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest ChartView Signals 1.4" + when: windowShown + + // Verify onSeriesAdded and onSeriesRemoved signals + function test_chartView() { + var series = chartView.createSeries(ChartView.SeriesTypeLine, "line"); + seriesAddedSpy.wait(); + compare(seriesAddedSpy.count, 1, "ChartView.onSeriesAdded"); + + // Modifying layout triggers more than one plotAreaChanged signal + chartView.titleFont.pixelSize = 50; + verify(plotAreaChangedSpy.count > 0, "ChartView.onPlotAreaChanged"); + + chartView.removeSeries(series); + seriesRemovedSpy.wait(); + compare(seriesRemovedSpy.count, 1, "ChartView.onSeriesAdded"); + } + } + + ChartView { + id: chartView + anchors.fill: parent + title: "Chart" + + SignalSpy { + id: plotAreaChangedSpy + target: chartView + signalName: "plotAreaChanged" + } + + SignalSpy { + id: seriesAddedSpy + target: chartView + signalName: "seriesAdded" + } + + SignalSpy { + id: seriesRemovedSpy + target: chartView + signalName: "seriesRemoved" + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_pieseries.qml b/tests/auto/qml-qtquicktest/tst_pieseries.qml index 0a888ee4..5aa83047 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries.qml +++ b/tests/auto/qml-qtquicktest/tst_pieseries.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml index b23ab504..c777779f 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml index 0b528d69..09c3d450 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml index 21b29c07..1a50cf85 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml new file mode 100644 index 00000000..5cfab8c9 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest PieSeries 1.4" + when: windowShown + + function test_properties() { + compare(pieSeries.endAngle, 360); + compare(pieSeries.holeSize, 0); + compare(pieSeries.horizontalPosition, 0.5); + compare(pieSeries.size, 0.7); + compare(pieSeries.startAngle, 0); + compare(pieSeries.sum, 0); + compare(pieSeries.verticalPosition, 0.5); + } + + function test_sliceproperties() { + var slice = pieSeries.append("slice", 10); + compare(slice.angleSpan, 360.0); + verify(slice.borderColor != undefined); + compare(slice.borderWidth, 1); + verify(slice.color != undefined); + compare(slice.explodeDistanceFactor, 0.15); + compare(slice.exploded, false); + compare(slice.label, "slice"); + compare(slice.labelArmLengthFactor, 0.15); + verify(slice.labelColor != undefined); + compare(slice.labelFont.bold, false); + compare(slice.labelPosition, PieSlice.LabelOutside); + compare(slice.labelVisible, false); + compare(slice.percentage, 1.0); + compare(slice.startAngle, 0.0); + compare(slice.value, 10.0); + compare(slice.brushFilename, ""); + } + + function test_append() { + addedSpy.clear(); + countChangedSpy.clear(); + sumChangedSpy.clear(); + var count = 50; + for (var i = 0; i < count; i++) + pieSeries.append("slice" + i, Math.random()); + compare(addedSpy.count, count); + compare(countChangedSpy.count, count); + compare(sumChangedSpy.count, count); + pieSeries.clear(); + } + + function test_remove() { + removedSpy.clear(); + countChangedSpy.clear(); + sumChangedSpy.clear(); + var count = 50; + for (var i = 0; i < count; i++) + pieSeries.append("slice" + i, Math.random()); + for (var j = 0; j < count; j++) + pieSeries.remove(pieSeries.at(0)); + compare(removedSpy.count, count); + compare(countChangedSpy.count, 2 * count); + compare(sumChangedSpy.count, 2 * count); + compare(pieSeries.count, 0); + } + + function test_find_and_at() { + var count = 50; + for (var i = 0; i < count; i++) + pieSeries.append("slice" + i, Math.random()); + for (var j = 0; j < count; j++) { + compare(pieSeries.find("slice" + j).label, "slice" + j); + compare(pieSeries.find("slice" + j).brushFilename, ""); + } + compare(pieSeries.at(3).brushFilename,""); + pieSeries.clear(); + } + } + + ChartView { + id: chartView + anchors.fill: parent + + PieSeries { + id: pieSeries + name: "pie" + + SignalSpy { + id: addedSpy + target: pieSeries + signalName: "added" + } + SignalSpy { + id: removedSpy + target: pieSeries + signalName: "removed" + } + SignalSpy { + id: sumChangedSpy + target: pieSeries + signalName: "sumChanged" + } + SignalSpy { + id: countChangedSpy + target: pieSeries + signalName: "countChanged" + } + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis.qml b/tests/auto/qml-qtquicktest/tst_valueaxis.qml index 24f61cad..add8ff6c 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis.qml +++ b/tests/auto/qml-qtquicktest/tst_valueaxis.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml index 481e9494..e54a81d7 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml index 24ca3d51..80075ee0 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml index 5bc1acb8..2e9528d2 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml b/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml new file mode 100644 index 00000000..b8bb0da5 --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest ValueAxis 1.4" + when: windowShown + + // test functions are run in alphabetical order, the name has 'a' so that it + // will be the first function to execute. + function test_a_properties() { + // Default properties + verify(axisX.min < 0, "AxisX min"); + verify(axisX.max > 0, "AxisX max"); + verify(axisY.min < 0, "AxisY min"); + verify(axisY.max > 0, "AxisY max"); + verify(axisX.tickCount == 5, "AxisX tick count"); + verify(axisY.tickCount == 5, "AxisY tick count"); + verify(axisX.labelFormat == "", "label format"); + + // Modify properties + axisX.tickCount = 3; + verify(axisX.tickCount == 3, "set tick count"); + } + + function test_functions() { + // Set the axis ranges to not "nice" ones... + var min = 0.032456456; + var max = 10.67845634; + axisX.min = min; + axisX.max = max; + axisY.min = min; + axisY.max = max; + + // ...And then apply nice numbers and verify the range was changed + axisX.applyNiceNumbers(); + axisY.applyNiceNumbers(); + verify(axisX.min != min); + verify(axisX.max != max); + verify(axisY.min != min); + verify(axisY.max != max); + } + + function test_signals() { + minChangedSpy.clear(); + maxChangedSpy.clear(); + axisX.min = 2; + compare(minChangedSpy.count, 1, "onMinChanged"); + compare(maxChangedSpy.count, 0, "onMaxChanged"); + + axisX.max = 8; + compare(minChangedSpy.count, 1, "onMinChanged"); + compare(maxChangedSpy.count, 1, "onMaxChanged"); + + // restore original values + axisX.min = 0; + axisX.max = 10; + compare(minChangedSpy.count, 2, "onMinChanged"); + compare(maxChangedSpy.count, 2, "onMaxChanged"); + } + } + + ChartView { + id: chartView + anchors.fill: parent + + LineSeries { + id: lineSeries1 + axisX: ValueAxis { + id: axisX + } + axisY: ValueAxis { + id: axisY + } + XYPoint { x: -1; y: -1 } + XYPoint { x: 0; y: 0 } + XYPoint { x: 5; y: 5 } + } + + SignalSpy { + id: minChangedSpy + target: axisX + signalName: "minChanged" + } + SignalSpy { + id: maxChangedSpy + target: axisX + signalName: "maxChanged" + } + } +} diff --git a/tests/auto/qml-qtquicktest/tst_xyseries.qml b/tests/auto/qml-qtquicktest/tst_xyseries.qml index 383dcc8b..4a2db2e4 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries.qml +++ b/tests/auto/qml-qtquicktest/tst_xyseries.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.4 +import QtCharts 2.0 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml index dca20ca2..2c9f7024 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml +++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.1 +import QtCharts 1.1 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml index 5c1390fc..d20d2898 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml +++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.2 +import QtCharts 1.2 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml index 56130d94..0105dda9 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml @@ -20,7 +20,7 @@ import QtQuick 2.0 import QtTest 1.0 -import QtCommercial.Chart 1.3 +import QtCharts 1.3 Rectangle { width: 400 diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml b/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml new file mode 100644 index 00000000..1da8080b --- /dev/null +++ b/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml @@ -0,0 +1,262 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 Enterprise Charts Add-on. +** +** $QT_BEGIN_LICENSE$ +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise 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 2.0 +import QtTest 1.0 +import QtCharts 1.4 + +Rectangle { + width: 400 + height: 300 + + TestCase { + id: tc1 + name: "tst_qml-qtquicktest XY Series 1.4" + when: windowShown + + function test_properties() { + verify(lineSeries.color != undefined); + compare(lineSeries.pointsVisible, false); + compare(lineSeries.capStyle, Qt.SquareCap); + compare(lineSeries.style, Qt.SolidLine); + compare(lineSeries.width, 2.0); + + verify(splineSeries.color != undefined); + compare(splineSeries.pointsVisible, false); + compare(splineSeries.capStyle, Qt.SquareCap); + compare(splineSeries.style, Qt.SolidLine); + compare(splineSeries.width, 2.0); + + verify(scatterSeries.color != undefined); + verify(scatterSeries.borderColor != undefined); + compare(scatterSeries.borderWidth, 2.0); + compare(scatterSeries.markerShape, ScatterSeries.MarkerShapeCircle); + compare(scatterSeries.markerSize, 15.0); + compare(scatterSeries.brushFilename, ""); + + verify(areaSeries.color != undefined); + verify(areaSeries.borderColor != undefined); + compare(areaSeries.borderWidth, 2.0); + compare(areaSeries.brushFilename, ""); + } + + function test_axes() { + // Axis initialization + compare(chartView.axisX(), lineSeries.axisX); + compare(chartView.axisY(), lineSeries.axisY); + compare(lineSeries.axisX, splineSeries.axisX); + compare(lineSeries.axisY, splineSeries.axisY); + compare(lineSeries.axisX, areaSeries.axisX); + compare(lineSeries.axisY, areaSeries.axisY); + } + + function test_append() { + lineSeriesPointAddedSpy.clear(); + splineSeriesPointAddedSpy.clear(); + scatterSeriesPointAddedSpy.clear(); + var count = append(); + compare(lineSeries.count, count); + compare(splineSeries.count, count); + compare(scatterSeries.count, count); + compare(lineSeriesPointAddedSpy.count, count); + compare(splineSeriesPointAddedSpy.count, count); + compare(scatterSeriesPointAddedSpy.count, count); + clear(); + compare(lineSeries.count, 0); + compare(splineSeries.count, 0); + compare(scatterSeries.count, 0); + } + + function test_replace() { + var count = append(); + for (var i = 0; i < count; i++) { + lineSeries.replace(lineSeries.at(i).x, lineSeries.at(i).y, i, Math.random()); + splineSeries.replace(splineSeries.at(i).x, splineSeries.at(i).y, i, Math.random()); + scatterSeries.replace(scatterSeries.at(i).x, scatterSeries.at(i).y, i, Math.random()); + } + compare(lineSeries.count, count); + compare(splineSeries.count, count); + compare(scatterSeries.count, count); + compare(lineSeriesPointReplacedSpy.count, count); + compare(splineSeriesPointReplacedSpy.count, count); + compare(scatterSeriesPointReplacedSpy.count, count); + clear(); + } + + function test_insert() { + var count = append(); + lineSeriesPointAddedSpy.clear(); + splineSeriesPointAddedSpy.clear(); + scatterSeriesPointAddedSpy.clear(); + for (var i = 0; i < count; i++) { + lineSeries.insert(i * 2, i, Math.random()); + splineSeries.insert(i * 2, i, Math.random()); + scatterSeries.insert(i * 2, i, Math.random()); + } + compare(lineSeries.count, count * 2); + compare(splineSeries.count, count * 2); + compare(scatterSeries.count, count * 2); + compare(lineSeriesPointAddedSpy.count, count); + compare(splineSeriesPointAddedSpy.count, count); + compare(scatterSeriesPointAddedSpy.count, count); + clear(); + } + + function test_remove() { + lineSeriesPointRemovedSpy.clear(); + splineSeriesPointRemovedSpy.clear(); + scatterSeriesPointRemovedSpy.clear(); + var count = append(); + for (var i = 0; i < count; i++) { + lineSeries.remove(lineSeries.at(0).x, lineSeries.at(0).y); + splineSeries.remove(splineSeries.at(0).x, splineSeries.at(0).y); + scatterSeries.remove(scatterSeries.at(0).x, scatterSeries.at(0).y); + } + compare(lineSeries.count, 0); + compare(splineSeries.count, 0); + compare(scatterSeries.count, 0); + compare(lineSeriesPointRemovedSpy.count, count); + compare(splineSeriesPointRemovedSpy.count, count); + compare(scatterSeriesPointRemovedSpy.count, count); + } + + // Not a test function, called from test functions + function append() { + var count = 100; + chartView.axisX().min = 0; + chartView.axisX().max = 100; + chartView.axisY().min = 0; + chartView.axisY().max = 1; + + for (var i = 0; i < count; i++) { + lineSeries.append(i, Math.random()); + splineSeries.append(i, Math.random()); + scatterSeries.append(i, Math.random()); + } + + return count; + } + + // Not a test function, called from test functions + function clear() { + lineSeries.clear(); + splineSeries.clear(); + scatterSeries.clear(); + } + } + + ChartView { + id: chartView + anchors.fill: parent + + LineSeries { + id: lineSeries + name: "line" + + SignalSpy { + id: lineSeriesPointAddedSpy + target: lineSeries + signalName: "pointAdded" + } + + SignalSpy { + id: lineSeriesPointReplacedSpy + target: lineSeries + signalName: "pointReplaced" + } + + SignalSpy { + id: lineSeriesPointsReplacedSpy + target: lineSeries + signalName: "pointsReplaced" + } + + SignalSpy { + id: lineSeriesPointRemovedSpy + target: lineSeries + signalName: "pointRemoved" + } + } + + AreaSeries { + id: areaSeries + name: "area" + upperSeries: lineSeries + } + + SplineSeries { + id: splineSeries + name: "spline" + + SignalSpy { + id: splineSeriesPointAddedSpy + target: splineSeries + signalName: "pointAdded" + } + + SignalSpy { + id: splineSeriesPointReplacedSpy + target: splineSeries + signalName: "pointReplaced" + } + + SignalSpy { + id: splineSeriesPointsReplacedSpy + target: splineSeries + signalName: "pointsReplaced" + } + + SignalSpy { + id: splineSeriesPointRemovedSpy + target: splineSeries + signalName: "pointRemoved" + } + } + + ScatterSeries { + id: scatterSeries + name: "scatter" + + SignalSpy { + id: scatterSeriesPointAddedSpy + target: scatterSeries + signalName: "pointAdded" + } + + SignalSpy { + id: scatterSeriesPointReplacedSpy + target: scatterSeries + signalName: "pointReplaced" + } + + SignalSpy { + id: scatterSeriesPointsReplacedSpy + target: scatterSeries + signalName: "pointsReplaced" + } + + SignalSpy { + id: scatterSeriesPointRemovedSpy + target: scatterSeries + signalName: "pointRemoved" + } + } + } +} diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 144e5db3..f116195d 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -2,4 +2,4 @@ error( "Couldn't find the auto.pri file!" ) } SOURCES += tst_qml.cpp -QT += declarative +QT += qml quick diff --git a/tests/auto/qml/tst_qml.cpp b/tests/auto/qml/tst_qml.cpp index f33f820b..1078129b 100644 --- a/tests/auto/qml/tst_qml.cpp +++ b/tests/auto/qml/tst_qml.cpp @@ -18,12 +18,11 @@ ** ****************************************************************************/ #include <QtTest/QtTest> -#include <QDeclarativeEngine> -#include <QDeclarativeComponent> -#include <QDir> +#include <QtQml/QQmlEngine> +#include <QtQml/QQmlComponent> #include "tst_definitions.h" -class tst_QML : public QObject +class tst_qml : public QObject { Q_OBJECT @@ -36,57 +35,70 @@ private slots: void checkPlugin_data(); void checkPlugin(); private: - QString componentErrors(const QDeclarativeComponent* component) const; + QString componentErrors(const QQmlComponent* component) const; QString imports_1_1(); QString imports_1_3(); + QString imports_1_4(); + QString imports_2_0(); }; -QString tst_QML::componentErrors(const QDeclarativeComponent* component) const +QString tst_qml::componentErrors(const QQmlComponent* component) const { Q_ASSERT(component); QStringList errors; - foreach (QDeclarativeError const& error, component->errors()) { + foreach (QQmlError const& error, component->errors()) { errors << error.toString(); } return errors.join("\n"); } -QString tst_QML::imports_1_1() +QString tst_qml::imports_1_1() { - return "import QtQuick 1.0 \n" - "import QtCommercial.Chart 1.1 \n"; + return "import QtQuick 2.0 \n" + "import QtCharts 1.1 \n"; } -QString tst_QML::imports_1_3() +QString tst_qml::imports_1_3() { - return "import QtQuick 1.0 \n" - "import QtCommercial.Chart 1.3 \n"; + return "import QtQuick 2.0 \n" + "import QtCharts 1.3 \n"; } +QString tst_qml::imports_1_4() +{ + return "import QtQuick 2.0 \n" + "import QtCharts 1.4 \n"; +} + +QString tst_qml::imports_2_0() +{ + return "import QtQuick 2.0 \n" + "import QtCharts 2.0 \n"; +} -void tst_QML::initTestCase() +void tst_qml::initTestCase() { } -void tst_QML::cleanupTestCase() +void tst_qml::cleanupTestCase() { } -void tst_QML::init() +void tst_qml::init() { } -void tst_QML::cleanup() +void tst_qml::cleanup() { } -void tst_QML::checkPlugin_data() +void tst_qml::checkPlugin_data() { QTest::addColumn<QString>("source"); @@ -121,33 +133,60 @@ void tst_QML::checkPlugin_data() QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}"; QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}"; + QTest::newRow("BoxPlotSeries") << imports_1_3() + "BoxPlotSeries{}"; + QTest::newRow("BoxSet") << imports_1_3() + "BoxSet{}"; + + QTest::newRow("createChartView_2_0") << imports_2_0() + "ChartView{}"; + QTest::newRow("XYPoint_2_0") << imports_2_0() + "XYPoint{}"; + QTest::newRow("scatterSeries_2_0") << imports_2_0() + "ScatterSeries{}"; + QTest::newRow("lineSeries_2_0") << imports_2_0() + "LineSeries{}"; + QTest::newRow("splineSeries_2_0") << imports_2_0() + "SplineSeries{}"; + QTest::newRow("areaSeries_2_0") << imports_2_0() + "AreaSeries{}"; + QTest::newRow("barSeries_2_0") << imports_2_0() + "BarSeries{}"; + QTest::newRow("stackedBarSeries_2_0") << imports_2_0() + "StackedBarSeries{}"; + QTest::newRow("precentBarSeries_2_0") << imports_2_0() + "PercentBarSeries{}"; + QTest::newRow("horizonatlBarSeries_2_0") << imports_2_0() + "HorizontalBarSeries{}"; + QTest::newRow("horizonatlStackedBarSeries_2_0") + << imports_2_0() + "HorizontalStackedBarSeries{}"; + QTest::newRow("horizonatlstackedBarSeries_2_0") + << imports_2_0() + "HorizontalPercentBarSeries{}"; + QTest::newRow("pieSeries_2_0") << imports_2_0() + "PieSeries{}"; + QTest::newRow("PieSlice_2_0") << imports_2_0() + "PieSlice{}"; + QTest::newRow("BarSet_2_0") << imports_2_0() + "BarSet{}"; + QTest::newRow("HXYModelMapper_2_0") << imports_2_0() + "HXYModelMapper{}"; + QTest::newRow("VXYModelMapper_2_0") << imports_2_0() + "VXYModelMapper{}"; + QTest::newRow("HPieModelMapper_2_0") << imports_2_0() + "HPieModelMapper{}"; + QTest::newRow("HPieModelMapper_2_0") << imports_2_0() + "HPieModelMapper{}"; + QTest::newRow("HBarModelMapper_2_0") << imports_2_0() + "HBarModelMapper{}"; + QTest::newRow("VBarModelMapper_2_0") << imports_2_0() + "VBarModelMapper{}"; + QTest::newRow("ValueAxis_2_0") << imports_2_0() + "ValueAxis{}"; +#ifndef QT_ON_ARM + QTest::newRow("DateTimeAxis_2_0") << imports_2_0() + "DateTimeAxis{}"; +#endif + QTest::newRow("CategoryAxis_2_0") << imports_2_0() + "CategoryAxis{}"; + QTest::newRow("CategoryRange_2_0") << imports_2_0() + "CategoryRange{}"; + QTest::newRow("BarCategoryAxis_2_0") << imports_2_0() + "BarCategoryAxis{}"; + QTest::newRow("createPolarChartView_2_0") << imports_2_0() + "PolarChartView{}"; + QTest::newRow("LogValueAxis_2_0") << imports_2_0() + "LogValueAxis{}"; + QTest::newRow("BoxPlotSeries_2_0") << imports_2_0() + "BoxPlotSeries{}"; + QTest::newRow("BoxSet_2_0") << imports_2_0() + "BoxSet{}"; } -void tst_QML::checkPlugin() +void tst_qml::checkPlugin() { QFETCH(QString, source); - QDeclarativeEngine engine; -#ifdef Q_OS_ANDROID - engine.addImportPath(QString::fromLatin1("assets:/imports")); - engine.addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib"))); -#else - engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports"))); -#endif - QDeclarativeComponent component(&engine); + QQmlEngine engine; + engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("qml"))); + QQmlComponent component(&engine); component.setData(source.toLatin1(), QUrl()); QVERIFY2(!component.isError(), qPrintable(componentErrors(&component))); - TRY_COMPARE(component.status(), QDeclarativeComponent::Ready); + TRY_COMPARE(component.status(), QQmlComponent::Ready); QObject *obj = component.create(); QVERIFY(obj != 0); - - // - //TODO: - // QCOMPARE(obj->property("something").toInt(), 0); - delete obj; } -QTEST_MAIN(tst_QML) +QTEST_MAIN(tst_qml) #include "tst_qml.moc" diff --git a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp index caf3eaba..dbe768e9 100644 --- a/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp +++ b/tests/auto/qpercentbarseries/tst_qpercentbarseries.cpp @@ -25,7 +25,7 @@ #include <qchart.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QBarSet*) Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition) diff --git a/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp b/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp index 0b672e40..28cf4a29 100644 --- a/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp +++ b/tests/auto/qpiemodelmapper/tst_qpiemodelmapper.cpp @@ -29,7 +29,7 @@ #include <qhpiemodelmapper.h> #include <QStandardItemModel> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_qpiemodelmapper : public QObject { diff --git a/tests/auto/qpieseries/tst_qpieseries.cpp b/tests/auto/qpieseries/tst_qpieseries.cpp index 06e7022b..3b8f2adb 100644 --- a/tests/auto/qpieseries/tst_qpieseries.cpp +++ b/tests/auto/qpieseries/tst_qpieseries.cpp @@ -27,7 +27,7 @@ #include <QStandardItemModel> #include <tst_definitions.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QPieSlice*) Q_DECLARE_METATYPE(QList<QPieSlice*>) diff --git a/tests/auto/qpieslice/tst_qpieslice.cpp b/tests/auto/qpieslice/tst_qpieslice.cpp index 678bf911..3ad5c47d 100644 --- a/tests/auto/qpieslice/tst_qpieslice.cpp +++ b/tests/auto/qpieslice/tst_qpieslice.cpp @@ -25,7 +25,7 @@ #include <qpieslice.h> #include <qpieseries.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_qpieslice : public QObject { diff --git a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp index 6285aaa1..868a61a1 100644 --- a/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp +++ b/tests/auto/qstackedbarseries/tst_qstackedbarseries.cpp @@ -25,7 +25,7 @@ #include <qchart.h> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE Q_DECLARE_METATYPE(QBarSet*) Q_DECLARE_METATYPE(QAbstractBarSeries::LabelsPosition) diff --git a/tests/auto/quick2/quick2.pro b/tests/auto/quick2/quick2.pro deleted file mode 100644 index 93f8fdfe..00000000 --- a/tests/auto/quick2/quick2.pro +++ /dev/null @@ -1,5 +0,0 @@ -!include( ../auto.pri ) { - error( "Couldn't find the auto.pri file!" ) -} -SOURCES += tst_quick2.cpp -QT += qml quick diff --git a/tests/auto/quick2/tst_quick2.cpp b/tests/auto/quick2/tst_quick2.cpp deleted file mode 100644 index 67b1b2da..00000000 --- a/tests/auto/quick2/tst_quick2.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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$ -** -****************************************************************************/ -#include <QtTest/QtTest> -#include <QtQml/QQmlEngine> -#include <QtQml/QQmlComponent> -#include "tst_definitions.h" - -class tst_quick2 : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); -private slots: - void checkPlugin_data(); - void checkPlugin(); -private: - QString componentErrors(const QQmlComponent* component) const; - QString imports_1_1(); - QString imports_1_3(); - -}; - -QString tst_quick2::componentErrors(const QQmlComponent* component) const -{ - Q_ASSERT(component); - - QStringList errors; - - foreach (QQmlError const& error, component->errors()) { - errors << error.toString(); - } - - return errors.join("\n"); -} - -QString tst_quick2::imports_1_1() -{ - return "import QtQuick 2.0 \n" - "import QtCommercial.Chart 1.1 \n"; -} - -QString tst_quick2::imports_1_3() -{ - return "import QtQuick 2.0 \n" - "import QtCommercial.Chart 1.3 \n"; -} - - -void tst_quick2::initTestCase() -{ -} - -void tst_quick2::cleanupTestCase() -{ -} - -void tst_quick2::init() -{ - -} - -void tst_quick2::cleanup() -{ - -} - -void tst_quick2::checkPlugin_data() -{ - QTest::addColumn<QString>("source"); - - QTest::newRow("createChartView") << imports_1_1() + "ChartView{}"; - QTest::newRow("XYPoint") << imports_1_1() + "XYPoint{}"; - QTest::newRow("scatterSeries") << imports_1_1() + "ScatterSeries{}"; - QTest::newRow("lineSeries") << imports_1_1() + "LineSeries{}"; - QTest::newRow("splineSeries") << imports_1_1() + "SplineSeries{}"; - QTest::newRow("areaSeries") << imports_1_1() + "AreaSeries{}"; - QTest::newRow("barSeries") << imports_1_1() + "BarSeries{}"; - QTest::newRow("stackedBarSeries") << imports_1_1() + "StackedBarSeries{}"; - QTest::newRow("precentBarSeries") << imports_1_1() + "PercentBarSeries{}"; - QTest::newRow("horizonatlBarSeries") << imports_1_1() + "HorizontalBarSeries{}"; - QTest::newRow("horizonatlStackedBarSeries") << imports_1_1() + "HorizontalStackedBarSeries{}"; - QTest::newRow("horizonatlstackedBarSeries") << imports_1_1() + "HorizontalPercentBarSeries{}"; - QTest::newRow("pieSeries") << imports_1_1() + "PieSeries{}"; - QTest::newRow("PieSlice") << imports_1_1() + "PieSlice{}"; - QTest::newRow("BarSet") << imports_1_1() + "BarSet{}"; - QTest::newRow("HXYModelMapper") << imports_1_1() + "HXYModelMapper{}"; - QTest::newRow("VXYModelMapper") << imports_1_1() + "VXYModelMapper{}"; - QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}"; - QTest::newRow("HPieModelMapper") << imports_1_1() + "HPieModelMapper{}"; - QTest::newRow("HBarModelMapper") << imports_1_1() + "HBarModelMapper{}"; - QTest::newRow("VBarModelMapper") << imports_1_1() + "VBarModelMapper{}"; - QTest::newRow("ValueAxis") << imports_1_1() + "ValueAxis{}"; -#ifndef QT_ON_ARM - QTest::newRow("DateTimeAxis") << imports_1_1() + "DateTimeAxis{}"; -#endif - QTest::newRow("CategoryAxis") << imports_1_1() + "CategoryAxis{}"; - QTest::newRow("CategoryRange") << imports_1_1() + "CategoryRange{}"; - QTest::newRow("BarCategoryAxis") << imports_1_1() + "BarCategoryAxis{}"; - - QTest::newRow("createPolarChartView") << imports_1_3() + "PolarChartView{}"; - QTest::newRow("LogValueAxis") << imports_1_3() + "LogValueAxis{}"; -} - -void tst_quick2::checkPlugin() -{ - QFETCH(QString, source); - QQmlEngine engine; - engine.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("qml"))); - QQmlComponent component(&engine); - component.setData(source.toLatin1(), QUrl()); - QVERIFY2(!component.isError(), qPrintable(componentErrors(&component))); - TRY_COMPARE(component.status(), QQmlComponent::Ready); - QObject *obj = component.create(); - QVERIFY(obj != 0); - delete obj; -} - -QTEST_MAIN(tst_quick2) - -#include "tst_quick2.moc" - diff --git a/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp b/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp index e0b17f29..5431d5cf 100644 --- a/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp +++ b/tests/auto/qxymodelmapper/tst_qxymodelmapper.cpp @@ -30,7 +30,7 @@ #include <QStandardItemModel> #include "tst_definitions.h" -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_qxymodelmapper : public QObject { diff --git a/tests/auto/qxyseries/tst_qxyseries.h b/tests/auto/qxyseries/tst_qxyseries.h index 0fad782c..58d6a5c6 100644 --- a/tests/auto/qxyseries/tst_qxyseries.h +++ b/tests/auto/qxyseries/tst_qxyseries.h @@ -27,7 +27,7 @@ #include <QStandardItemModel> #include <tst_definitions.h> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class tst_QXYSeries : public QObject { diff --git a/tests/boxplottester/main.cpp b/tests/boxplottester/main.cpp index cb2fd866..6d136669 100644 --- a/tests/boxplottester/main.cpp +++ b/tests/boxplottester/main.cpp @@ -19,11 +19,7 @@ ****************************************************************************/ #include <QtCore/QtGlobal> -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) -#include <QApplication> -#else #include <QtWidgets/QApplication> -#endif #include "mainwidget.h" int main(int argc, char *argv[]) diff --git a/tests/boxplottester/mainwidget.cpp b/tests/boxplottester/mainwidget.cpp index fb68a296..3421de05 100644 --- a/tests/boxplottester/mainwidget.cpp +++ b/tests/boxplottester/mainwidget.cpp @@ -46,7 +46,7 @@ #include <QBarCategoryAxis> #include <QLogValueAxis> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE static const QString allCategories[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; static const int maxCategories = 12; @@ -129,13 +129,8 @@ MainWidget::MainWidget(QWidget *parent) : tableView->setModel(m_model); tableView->setMaximumWidth(200); grid->addWidget(tableView, m_rowPos++, 0, 3, 2, Qt::AlignLeft); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); tableView->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); -#else - tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); - tableView->verticalHeader()->setResizeMode(QHeaderView::Stretch); -#endif // add row with empty label to make all the other rows static grid->addWidget(new QLabel(""), grid->rowCount(), 0); diff --git a/tests/boxplottester/mainwidget.h b/tests/boxplottester/mainwidget.h index 2c9ab5b3..3c78ffd2 100644 --- a/tests/boxplottester/mainwidget.h +++ b/tests/boxplottester/mainwidget.h @@ -35,7 +35,7 @@ class QGridLayout; -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class MainWidget : public QWidget { diff --git a/tests/chartdesigner/engine.cpp b/tests/chartdesigner/engine.cpp index d8b8b70b..ac113ed5 100644 --- a/tests/chartdesigner/engine.cpp +++ b/tests/chartdesigner/engine.cpp @@ -163,7 +163,7 @@ void Engine::removeSeries(QAbstractSeries* series) m_chart->removeSeries(series); foreach (const QModelIndex& index, m_seriesModelIndex.value(series)) { - m_model->setData(index, Qt::white, Qt::BackgroundRole); + m_model->setData(index, QColor(Qt::white), Qt::BackgroundRole); } } diff --git a/tests/chartdesigner/engine.h b/tests/chartdesigner/engine.h index 29e85955..96323592 100644 --- a/tests/chartdesigner/engine.h +++ b/tests/chartdesigner/engine.h @@ -29,15 +29,15 @@ class QStandardItemModel; class QItemSelectionModel; -QTCOMMERCIALCHART_BEGIN_NAMESPACE +QT_CHARTS_BEGIN_NAMESPACE class QChart; class QXYSeries; class QAbstractBarSeries; class QPieSeries; class QAreaSeries; -QTCOMMERCIALCHART_END_NAMESPACE +QT_CHARTS_END_NAMESPACE -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class Engine : public QObject { diff --git a/tests/chartdesigner/mainwindow.cpp b/tests/chartdesigner/mainwindow.cpp index e84c0d43..0527bdd1 100644 --- a/tests/chartdesigner/mainwindow.cpp +++ b/tests/chartdesigner/mainwindow.cpp @@ -203,7 +203,7 @@ void MainWindow::createDockWidgets() void MainWindow::createLayout() { - m_table->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + m_table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); int rowHeight = m_table->rowHeight(0); int tableHeight = (m_engine->modelCount() * rowHeight) + m_table->horizontalHeader()->height() + 2 * m_table->frameWidth(); diff --git a/tests/chartdesigner/mainwindow.h b/tests/chartdesigner/mainwindow.h index da03b2b4..6f21b166 100644 --- a/tests/chartdesigner/mainwindow.h +++ b/tests/chartdesigner/mainwindow.h @@ -26,10 +26,10 @@ #include <QMap> -QTCOMMERCIALCHART_BEGIN_NAMESPACE +QT_CHARTS_BEGIN_NAMESPACE class QChartView; class QAbstractSeries; -QTCOMMERCIALCHART_END_NAMESPACE +QT_CHARTS_END_NAMESPACE class QGraphicsScene; class InspectorWidget; @@ -38,7 +38,7 @@ class PenWidget; class QTableView; class Engine; -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class MainWindow : public QMainWindow { diff --git a/tests/chartviewer/charts.h b/tests/chartviewer/charts.h index 9bc20ef1..ab25467f 100644 --- a/tests/chartviewer/charts.h +++ b/tests/chartviewer/charts.h @@ -26,11 +26,11 @@ #include <QString> #include <qchartglobal.h> -QTCOMMERCIALCHART_BEGIN_NAMESPACE +QT_CHARTS_BEGIN_NAMESPACE class QChart; -QTCOMMERCIALCHART_END_NAMESPACE +QT_CHARTS_END_NAMESPACE -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class Chart { diff --git a/tests/chartviewer/chartviewer.pro b/tests/chartviewer/chartviewer.pro index 3ab604c8..c306252a 100644 --- a/tests/chartviewer/chartviewer.pro +++ b/tests/chartviewer/chartviewer.pro @@ -1,4 +1,4 @@ -!include( ../tests.pri ):error( "Couldn't find the demos.pri file!" ) +!include( ../tests.pri ):error( "Couldn't find the tests.pri file!" ) include(charts/charts.pri) TARGET = chartviewer QT += opengl diff --git a/tests/chartviewer/grid.h b/tests/chartviewer/grid.h index 56d5f065..276fcceb 100644 --- a/tests/chartviewer/grid.h +++ b/tests/chartviewer/grid.h @@ -28,11 +28,11 @@ class QGraphicsGridLayout; class Chart; -QTCOMMERCIALCHART_BEGIN_NAMESPACE +QT_CHARTS_BEGIN_NAMESPACE class QChart; -QTCOMMERCIALCHART_END_NAMESPACE +QT_CHARTS_END_NAMESPACE -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class Grid : public QGraphicsWidget { diff --git a/tests/chartviewer/window.h b/tests/chartviewer/window.h index 02d5a39e..53fa7171 100644 --- a/tests/chartviewer/window.h +++ b/tests/chartviewer/window.h @@ -35,11 +35,11 @@ class Chart; class Grid; class QPushButton; -QTCOMMERCIALCHART_BEGIN_NAMESPACE +QT_CHARTS_BEGIN_NAMESPACE class QChart; -QTCOMMERCIALCHART_END_NAMESPACE +QT_CHARTS_END_NAMESPACE -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class Window: public QMainWindow diff --git a/tests/chartwidgettest/main.cpp b/tests/chartwidgettest/main.cpp index cb2fd866..6d136669 100644 --- a/tests/chartwidgettest/main.cpp +++ b/tests/chartwidgettest/main.cpp @@ -19,11 +19,7 @@ ****************************************************************************/ #include <QtCore/QtGlobal> -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) -#include <QApplication> -#else #include <QtWidgets/QApplication> -#endif #include "mainwidget.h" int main(int argc, char *argv[]) diff --git a/tests/chartwidgettest/mainwidget.cpp b/tests/chartwidgettest/mainwidget.cpp index 72c98b60..76676a93 100644 --- a/tests/chartwidgettest/mainwidget.cpp +++ b/tests/chartwidgettest/mainwidget.cpp @@ -45,7 +45,7 @@ #include <QBarCategoryAxis>
#include <QGLWidget>
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
@@ -322,6 +322,7 @@ void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS for (int j(0); j < data.count(); j ++) {
QList<qreal> column = data.at(j);
QSplineSeries *series = new QSplineSeries();
+ series->setName("spline" + QString::number(j));
for (int i(0); i < column.count(); i++)
series->append(i, column.at(i));
m_chart->addSeries(series);
diff --git a/tests/chartwidgettest/mainwidget.h b/tests/chartwidgettest/mainwidget.h index 381add28..49d36518 100644 --- a/tests/chartwidgettest/mainwidget.h +++ b/tests/chartwidgettest/mainwidget.h @@ -30,7 +30,7 @@ class QSpinBox; class QCheckBox;
class QGridLayout;
-QTCOMMERCIALCHART_USE_NAMESPACE
+QT_CHARTS_USE_NAMESPACE
#define RealList QList<qreal>
class DataSerieDialog;
diff --git a/tests/polarcharttest/chartview.cpp b/tests/polarcharttest/chartview.cpp index 558ae3c1..f0d72994 100644 --- a/tests/polarcharttest/chartview.cpp +++ b/tests/polarcharttest/chartview.cpp @@ -23,7 +23,7 @@ #include <QDebug> #include <QAbstractAxis> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE ChartView::ChartView(QWidget *parent) : QChartView(parent) diff --git a/tests/polarcharttest/chartview.h b/tests/polarcharttest/chartview.h index 58fcf9fc..550e8d83 100644 --- a/tests/polarcharttest/chartview.h +++ b/tests/polarcharttest/chartview.h @@ -24,7 +24,7 @@ #include <QChartView> #include <QPolarChart> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class ChartView : public QChartView { diff --git a/tests/polarcharttest/mainwindow.cpp b/tests/polarcharttest/mainwindow.cpp index 0307ec1a..e1dddcc9 100644 --- a/tests/polarcharttest/mainwindow.cpp +++ b/tests/polarcharttest/mainwindow.cpp @@ -35,7 +35,7 @@ #include <qmath.h> #include <QDateTime> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : diff --git a/tests/polarcharttest/mainwindow.h b/tests/polarcharttest/mainwindow.h index cff0bbf7..c16a292e 100644 --- a/tests/polarcharttest/mainwindow.h +++ b/tests/polarcharttest/mainwindow.h @@ -34,7 +34,7 @@ namespace Ui { class MainWindow; } -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class QBrush; class QPen; diff --git a/tests/presenterchart/chartview.h b/tests/presenterchart/chartview.h index 5b0b20fd..8753a11b 100644 --- a/tests/presenterchart/chartview.h +++ b/tests/presenterchart/chartview.h @@ -24,7 +24,7 @@ #include <QChartView> #include <QTimer> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE //![1] class ChartView: public QChartView diff --git a/tests/qmlchartaxis/main.cpp b/tests/qmlchartaxis/main.cpp index 01aad92d..fb4d56f8 100644 --- a/tests/qmlchartaxis/main.cpp +++ b/tests/qmlchartaxis/main.cpp @@ -19,24 +19,30 @@ ****************************************************************************/ #include <QApplication> -#include <QDeclarativeEngine> -#include <QDir> -#include "qmlapplicationviewer.h" +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> -Q_DECL_EXPORT int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { - QScopedPointer<QApplication> app(createApplication(argc, argv)); - QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); -#ifdef Q_OS_ANDROID - viewer->addImportPath(QString::fromLatin1("assets:/imports")); - viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib"))); + // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used. + QApplication app(argc, argv); + + QQuickView viewer; + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../../%2")); #else - viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports"))); + QString extraImportPath(QStringLiteral("%1/../../../%2")); #endif + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); - // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer->setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml")); - viewer->showExpanded(); + viewer.setSource(QUrl("qrc:/qml/qmlchartaxis/main.qml")); + viewer.show(); - return app->exec(); + return app.exec(); } diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml b/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml index 0c8b2017..61df081d 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/Button.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Rectangle { id: button diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml index 9ca03542..69250a39 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxes.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml index d33232fe..524e3314 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/ChartAxesRevert.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml b/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml index 92b0fd19..9e24b47b 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/ConfiguringDynamically.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "configuring dynamically" diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml b/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml index 430862f1..209ef372 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/CreatingDynamically.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml index aee18c00..2cab44fd 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAndUserDefined.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "default + user defined" diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml index 06ba224a..f06dd7cf 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxes.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml index 273db92e..67685082 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/DefaultAxesRevert.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml b/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml index 74e62f2d..caafabb7 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/Legacy.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml b/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml index 91d562e0..c9ac5d92 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/SeriesSpecificDynamic.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "series specific dynamic axes" diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml b/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml index ef08fe51..db11c9ee 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/SwitchingDynamically.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml index 1e42017f..f87c18cb 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefined.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "user defined" diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml index d1b3fce1..ea625c22 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/UserDefinedRevert.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "user defined reverted" diff --git a/tests/qmlchartaxis/qml/qmlchartaxis/main.qml b/tests/qmlchartaxis/qml/qmlchartaxis/main.qml index fa718a46..f973bf7a 100644 --- a/tests/qmlchartaxis/qml/qmlchartaxis/main.qml +++ b/tests/qmlchartaxis/qml/qmlchartaxis/main.qml @@ -18,12 +18,12 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Rectangle { id: main - width: 400 - height: 300 + width: 500 + height: 400 property string viewName: "DefaultAxes" Row { diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp deleted file mode 100644 index cb227056..00000000 --- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// checksum 0xaa72 version 0x90018 -/* - This file was generated by the Qt Quick Application wizard of Qt Creator. - QmlApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#include "qmlapplicationviewer.h" - -#include <QDir> -#include <QFileInfo> -#include <QApplication> -#include <QDeclarativeComponent> -#include <QDeclarativeEngine> -#include <QDeclarativeContext> - -#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN - -#ifdef HARMATTAN_BOOSTER -#include <MDeclarativeCache> -#endif - -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 - -#include <qt_private/qdeclarativedebughelper_p.h> - -#if !defined(NO_JSDEBUGGER) -#include <jsdebuggeragent.h> -#endif -#if !defined(NO_QMLOBSERVER) -#include <qdeclarativeviewobserver.h> -#endif - -// Enable debugging before any QDeclarativeEngine is created -struct QmlJsDebuggingEnabler -{ - QmlJsDebuggingEnabler() - { - QDeclarativeDebugHelper::enableDebugging(); - } -}; - -// Execute code in constructor before first QDeclarativeEngine is instantiated -static QmlJsDebuggingEnabler enableDebuggingHelper; - -#endif // QMLJSDEBUGGER - -class QmlApplicationViewerPrivate -{ - QString mainQmlFile; - friend class QmlApplicationViewer; - static QString adjustPath(const QString &path); -}; - -QString QmlApplicationViewerPrivate::adjustPath(const QString &path) -{ -#ifdef Q_OS_MAC - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/../Resources/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_BLACKBERRY) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("app/native/%1").arg(path); -#elif !defined(Q_OS_ANDROID) - QString pathInInstallDir = - QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; - pathInInstallDir = - QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif - return path; -} - -QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) - : QDeclarativeView(parent) - , d(new QmlApplicationViewerPrivate()) -{ - connect(engine(), SIGNAL(quit()), SLOT(close())); - setResizeMode(QDeclarativeView::SizeRootObjectToView); - - // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 -#if !defined(NO_JSDEBUGGER) - new QmlJSDebugger::JSDebuggerAgent(engine()); -#endif -#if !defined(NO_QMLOBSERVER) - new QmlJSDebugger::QDeclarativeViewObserver(this, this); -#endif -#endif -} - -QmlApplicationViewer::~QmlApplicationViewer() -{ - delete d; -} - -QmlApplicationViewer *QmlApplicationViewer::create() -{ - return new QmlApplicationViewer(); -} - -void QmlApplicationViewer::setMainQmlFile(const QString &file) -{ - d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); -#ifdef Q_OS_ANDROID - setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); -#else - setSource(QUrl::fromLocalFile(d->mainQmlFile)); -#endif -} - -void QmlApplicationViewer::addImportPath(const QString &path) -{ - engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); -} - -void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) -{ -#if QT_VERSION < 0x050000 - Qt::WidgetAttribute attribute; - switch (orientation) { -#if QT_VERSION < 0x040702 - // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes - case ScreenOrientationLockPortrait: - attribute = static_cast<Qt::WidgetAttribute>(128); - break; - case ScreenOrientationLockLandscape: - attribute = static_cast<Qt::WidgetAttribute>(129); - break; - default: - case ScreenOrientationAuto: - attribute = static_cast<Qt::WidgetAttribute>(130); - break; -#else // QT_VERSION < 0x040702 - case ScreenOrientationLockPortrait: - attribute = Qt::WA_LockPortraitOrientation; - break; - case ScreenOrientationLockLandscape: - attribute = Qt::WA_LockLandscapeOrientation; - break; - default: - case ScreenOrientationAuto: - attribute = Qt::WA_AutoOrientation; - break; -#endif // QT_VERSION < 0x040702 - }; - setAttribute(attribute, true); -#else // QT_VERSION < 0x050000 - Q_UNUSED(orientation) -#endif // QT_VERSION < 0x050000 -} - -void QmlApplicationViewer::showExpanded() -{ -#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) - showFullScreen(); -#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) - showMaximized(); -#else - show(); -#endif -} - -QApplication *createApplication(int &argc, char **argv) -{ -#ifdef HARMATTAN_BOOSTER - return MDeclarativeCache::qApplication(argc, argv); -#else - return new QApplication(argc, argv); -#endif -} diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h deleted file mode 100644 index adcb232f..00000000 --- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h +++ /dev/null @@ -1,46 +0,0 @@ -// checksum 0xc67a version 0x90018 -/* - This file was generated by the Qt Quick Application wizard of Qt Creator. - QmlApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#ifndef QMLAPPLICATIONVIEWER_H -#define QMLAPPLICATIONVIEWER_H - -#include <QDeclarativeView> - -class QmlApplicationViewer : public QDeclarativeView -{ - Q_OBJECT - -public: - enum ScreenOrientation { - ScreenOrientationLockPortrait, - ScreenOrientationLockLandscape, - ScreenOrientationAuto - }; - - explicit QmlApplicationViewer(QWidget *parent = 0); - virtual ~QmlApplicationViewer(); - - static QmlApplicationViewer *create(); - - void setMainQmlFile(const QString &file); - void addImportPath(const QString &path); - - // Note that this will only have an effect on Fremantle. - void setOrientation(ScreenOrientation orientation); - - void showExpanded(); - -private: - class QmlApplicationViewerPrivate *d; -}; - -QApplication *createApplication(int &argc, char **argv); - -#endif // QMLAPPLICATIONVIEWER_H diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri deleted file mode 100644 index 567c6dc6..00000000 --- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri +++ /dev/null @@ -1,13 +0,0 @@ -QT += declarative - -SOURCES += $$PWD/qmlapplicationviewer.cpp -HEADERS += $$PWD/qmlapplicationviewer.h -INCLUDEPATH += $$PWD - -# Include JS debugger library if QMLJSDEBUGGER_PATH is set -!isEmpty(QMLJSDEBUGGER_PATH) { - include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) -} else { - DEFINES -= QMLJSDEBUGGER -} - diff --git a/tests/qmlchartaxis/qmlchartaxis.pro b/tests/qmlchartaxis/qmlchartaxis.pro index 73a305c9..0abc1d4a 100644 --- a/tests/qmlchartaxis/qmlchartaxis.pro +++ b/tests/qmlchartaxis/qmlchartaxis.pro @@ -6,4 +6,3 @@ RESOURCES += resources.qrc SOURCES += main.cpp OTHER_FILES += qml/qmlchartaxis/* -include(qmlapplicationviewer/qmlapplicationviewer.pri) diff --git a/tests/qmlchartproperties/main.cpp b/tests/qmlchartproperties/main.cpp index 85f99adb..6eb3c801 100644 --- a/tests/qmlchartproperties/main.cpp +++ b/tests/qmlchartproperties/main.cpp @@ -19,25 +19,31 @@ ****************************************************************************/ #include <QApplication> -#include <QDeclarativeEngine> -#include <QDir> -#include "qmlapplicationviewer.h" +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> -Q_DECL_EXPORT int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { - QScopedPointer<QApplication> app(createApplication(argc, argv)); - QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); -#ifdef Q_OS_ANDROID - viewer->addImportPath(QString::fromLatin1("assets:/imports")); - viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib"))); + // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used. + QApplication app(argc, argv); + + QQuickView viewer; + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../../%2")); #else - viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports"))); + QString extraImportPath(QStringLiteral("%1/../../../%2")); #endif + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); - // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer->setSource(QUrl("qrc:/qml/qmlchartproperties/loader.qml")); - viewer->setRenderHint(QPainter::Antialiasing, true); - viewer->showExpanded(); + viewer.setSource(QUrl("qrc:/qml/qmlchartproperties/main.qml")); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.show(); - return app->exec(); + return app.exec(); } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml index 46959f7d..069e17de 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "area series" diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml index 69b2761a..168dc957 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Flow { id: flow diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml index d0e34326..ad088646 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "Bar series" diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml index 439d7f9e..cdd847a5 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/BarEditor.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Row { anchors.fill: parent diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml b/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml index 0c8b2017..61df081d 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/Button.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Rectangle { id: button diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml index 57d7407e..3f30ea44 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.3 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chartView @@ -78,7 +78,7 @@ ChartView { onMinChanged: console.log("axisX.onMinChanged: " + min); onMaxChanged: console.log("axisX.onMaxChanged: " + max); } - + ValueAxis{ onColorChanged: console.log("axisY.onColorChanged: " + color); onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible); diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml index f31b6a4c..87139f35 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditor.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: chartEditor @@ -84,7 +84,7 @@ Item { onClicked: { selectButton(axisXButton); loader.source = "ChartEditorAxis.qml"; - loader.item.axis = chart.axisX; + loader.item.axis = chart.axisX(); } } Button { @@ -94,7 +94,7 @@ Item { onClicked: { selectButton(axisYButton); loader.source = "ChartEditorAxis.qml"; - loader.item.axis = chart.axisY; + loader.item.axis = chart.axisY(); } } Button { diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml index ecd8d0a7..0c6d8dce 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorAxis.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Row { anchors.fill: parent diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml index 0c5ecd5b..24ffd9ef 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorLegend.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Row { anchors.fill: parent diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml index 5c8db45f..d172e4d8 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Flow { anchors.fill: parent diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml index 32c88a49..e7efc222 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorSeries.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 Flow { anchors.fill: parent diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml index 42babc29..61b4365f 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorTitle.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Flow { property variant chart diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml index 0ce70d95..3531597f 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/FontEditor.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Flow { flow: Flow.TopToBottom diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml index 7d24d2e6..aedb26cb 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalBarChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "Bar series" diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml index 70324888..c0d1b443 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalPercentBarChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "Percent bar series" @@ -33,6 +33,7 @@ ChartView { HorizontalPercentBarSeries { id: mySeries name: "bar" + labelsFormat: "@value"; axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] onClicked: console.log("barset.onClicked: " + index); diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml index 0367037b..3b94e89d 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/HorizontalStackedBarChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "Stacked bar series" diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml index dedeebcb..de3134a8 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { property variant series: lineSeries @@ -73,5 +73,6 @@ ChartView { XYPoint { x: 3.4; y: 2.0 } XYPoint { x: 4.1; y: 2.3 } onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); + onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); } } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml index f49dddcc..7960b4a1 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Flow { diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml index a9879c59..74c9b88f 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PercentBarChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "Percent bar series" diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml index 37da01ce..37a321ae 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PieChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { id: chart diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml index 60f3a659..91eb0343 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/PieEditor.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.1 +import QtQuick 2.0 +import QtCharts 2.0 Row { anchors.fill: parent diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml index cd898914..d531ac32 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "scatter series" @@ -43,6 +43,7 @@ ChartView { onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible); onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity); onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); + onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index); onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index); onPointAdded: console.log("scatterSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); @@ -69,5 +70,6 @@ ChartView { XYPoint { x: 2.4; y: 2.7 } XYPoint { x: 2.67; y: 2.65 } onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); + onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); } } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml index 753ab197..23afdb75 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml @@ -18,7 +18,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Flow { id: flow diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml index 5f534b97..3a182d19 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "spline series" @@ -44,6 +44,7 @@ ChartView { onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible); onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity); onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); + onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); onPointReplaced: console.log("splineSeries.onPointReplaced: " + index); onPointRemoved: console.log("splineSeries.onPointRemoved: " + index); onPointAdded: console.log("splineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); @@ -71,5 +72,6 @@ ChartView { XYPoint { x: 3.4; y: 2.0 } XYPoint { x: 4.1; y: 2.3 } onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); + onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); } } diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml index 5757a95c..a59f0e12 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/StackedBarChart.qml @@ -18,8 +18,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import QtCommercial.Chart 1.4 +import QtQuick 2.0 +import QtCharts 2.0 ChartView { title: "Stacked bar series" diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/loader.qml b/tests/qmlchartproperties/qml/qmlchartproperties/loader.qml deleted file mode 100644 index c04db7ff..00000000 --- a/tests/qmlchartproperties/qml/qmlchartproperties/loader.qml +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 - -Item { - id: container - width: 640 - height: 500 - Component.onCompleted: { - var co = Qt.createComponent("main.qml") - if (co.status == Component.Ready) { - var o = co.createObject(container) - } else { - console.log(co.errorString()) - console.log("QtCommercial.Chart 1.1 not available") - console.log("Please use correct QML_IMPORT_PATH export") - } - } -} diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/main.qml b/tests/qmlchartproperties/qml/qmlchartproperties/main.qml index 9d5334f6..8265e1ae 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/main.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/main.qml @@ -18,12 +18,12 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Rectangle { id: main - width: parent.width - height: parent.height + width: 800 + height: 600 property int viewCount: 9 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"] property int colorIndex: 0 diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp deleted file mode 100644 index cb227056..00000000 --- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// checksum 0xaa72 version 0x90018 -/* - This file was generated by the Qt Quick Application wizard of Qt Creator. - QmlApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#include "qmlapplicationviewer.h" - -#include <QDir> -#include <QFileInfo> -#include <QApplication> -#include <QDeclarativeComponent> -#include <QDeclarativeEngine> -#include <QDeclarativeContext> - -#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN - -#ifdef HARMATTAN_BOOSTER -#include <MDeclarativeCache> -#endif - -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 - -#include <qt_private/qdeclarativedebughelper_p.h> - -#if !defined(NO_JSDEBUGGER) -#include <jsdebuggeragent.h> -#endif -#if !defined(NO_QMLOBSERVER) -#include <qdeclarativeviewobserver.h> -#endif - -// Enable debugging before any QDeclarativeEngine is created -struct QmlJsDebuggingEnabler -{ - QmlJsDebuggingEnabler() - { - QDeclarativeDebugHelper::enableDebugging(); - } -}; - -// Execute code in constructor before first QDeclarativeEngine is instantiated -static QmlJsDebuggingEnabler enableDebuggingHelper; - -#endif // QMLJSDEBUGGER - -class QmlApplicationViewerPrivate -{ - QString mainQmlFile; - friend class QmlApplicationViewer; - static QString adjustPath(const QString &path); -}; - -QString QmlApplicationViewerPrivate::adjustPath(const QString &path) -{ -#ifdef Q_OS_MAC - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/../Resources/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_BLACKBERRY) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("app/native/%1").arg(path); -#elif !defined(Q_OS_ANDROID) - QString pathInInstallDir = - QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; - pathInInstallDir = - QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif - return path; -} - -QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) - : QDeclarativeView(parent) - , d(new QmlApplicationViewerPrivate()) -{ - connect(engine(), SIGNAL(quit()), SLOT(close())); - setResizeMode(QDeclarativeView::SizeRootObjectToView); - - // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 -#if !defined(NO_JSDEBUGGER) - new QmlJSDebugger::JSDebuggerAgent(engine()); -#endif -#if !defined(NO_QMLOBSERVER) - new QmlJSDebugger::QDeclarativeViewObserver(this, this); -#endif -#endif -} - -QmlApplicationViewer::~QmlApplicationViewer() -{ - delete d; -} - -QmlApplicationViewer *QmlApplicationViewer::create() -{ - return new QmlApplicationViewer(); -} - -void QmlApplicationViewer::setMainQmlFile(const QString &file) -{ - d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); -#ifdef Q_OS_ANDROID - setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); -#else - setSource(QUrl::fromLocalFile(d->mainQmlFile)); -#endif -} - -void QmlApplicationViewer::addImportPath(const QString &path) -{ - engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); -} - -void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) -{ -#if QT_VERSION < 0x050000 - Qt::WidgetAttribute attribute; - switch (orientation) { -#if QT_VERSION < 0x040702 - // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes - case ScreenOrientationLockPortrait: - attribute = static_cast<Qt::WidgetAttribute>(128); - break; - case ScreenOrientationLockLandscape: - attribute = static_cast<Qt::WidgetAttribute>(129); - break; - default: - case ScreenOrientationAuto: - attribute = static_cast<Qt::WidgetAttribute>(130); - break; -#else // QT_VERSION < 0x040702 - case ScreenOrientationLockPortrait: - attribute = Qt::WA_LockPortraitOrientation; - break; - case ScreenOrientationLockLandscape: - attribute = Qt::WA_LockLandscapeOrientation; - break; - default: - case ScreenOrientationAuto: - attribute = Qt::WA_AutoOrientation; - break; -#endif // QT_VERSION < 0x040702 - }; - setAttribute(attribute, true); -#else // QT_VERSION < 0x050000 - Q_UNUSED(orientation) -#endif // QT_VERSION < 0x050000 -} - -void QmlApplicationViewer::showExpanded() -{ -#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) - showFullScreen(); -#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) - showMaximized(); -#else - show(); -#endif -} - -QApplication *createApplication(int &argc, char **argv) -{ -#ifdef HARMATTAN_BOOSTER - return MDeclarativeCache::qApplication(argc, argv); -#else - return new QApplication(argc, argv); -#endif -} diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h deleted file mode 100644 index adcb232f..00000000 --- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h +++ /dev/null @@ -1,46 +0,0 @@ -// checksum 0xc67a version 0x90018 -/* - This file was generated by the Qt Quick Application wizard of Qt Creator. - QmlApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#ifndef QMLAPPLICATIONVIEWER_H -#define QMLAPPLICATIONVIEWER_H - -#include <QDeclarativeView> - -class QmlApplicationViewer : public QDeclarativeView -{ - Q_OBJECT - -public: - enum ScreenOrientation { - ScreenOrientationLockPortrait, - ScreenOrientationLockLandscape, - ScreenOrientationAuto - }; - - explicit QmlApplicationViewer(QWidget *parent = 0); - virtual ~QmlApplicationViewer(); - - static QmlApplicationViewer *create(); - - void setMainQmlFile(const QString &file); - void addImportPath(const QString &path); - - // Note that this will only have an effect on Fremantle. - void setOrientation(ScreenOrientation orientation); - - void showExpanded(); - -private: - class QmlApplicationViewerPrivate *d; -}; - -QApplication *createApplication(int &argc, char **argv); - -#endif // QMLAPPLICATIONVIEWER_H diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri deleted file mode 100644 index 567c6dc6..00000000 --- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri +++ /dev/null @@ -1,13 +0,0 @@ -QT += declarative - -SOURCES += $$PWD/qmlapplicationviewer.cpp -HEADERS += $$PWD/qmlapplicationviewer.h -INCLUDEPATH += $$PWD - -# Include JS debugger library if QMLJSDEBUGGER_PATH is set -!isEmpty(QMLJSDEBUGGER_PATH) { - include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) -} else { - DEFINES -= QMLJSDEBUGGER -} - diff --git a/tests/qmlchartproperties/qmlchartproperties.pro b/tests/qmlchartproperties/qmlchartproperties.pro index 8f2369c9..6d148e8b 100644 --- a/tests/qmlchartproperties/qmlchartproperties.pro +++ b/tests/qmlchartproperties/qmlchartproperties.pro @@ -6,4 +6,3 @@ RESOURCES += resources.qrc SOURCES += main.cpp OTHER_FILES += qml/qmlchartproperties/* -include(qmlapplicationviewer/qmlapplicationviewer.pri) diff --git a/tests/qmlchartproperties/resources.qrc b/tests/qmlchartproperties/resources.qrc index a95923d8..e93f369e 100644 --- a/tests/qmlchartproperties/resources.qrc +++ b/tests/qmlchartproperties/resources.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> - <file>qml/qmlchartproperties/loader.qml</file> <file>qml/qmlchartproperties/main.qml</file> <file>qml/qmlchartproperties/Button.qml</file> <file>qml/qmlchartproperties/PieChart.qml</file> diff --git a/tests/quick2chartproperties/main.cpp b/tests/quick2chartproperties/main.cpp deleted file mode 100644 index 950076e3..00000000 --- a/tests/quick2chartproperties/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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$ -** -****************************************************************************/ - -#include <QtWidgets/QApplication> -#include <QtQuick/QQuickItem> -#include <QDir> -#include <QtQml/QQmlEngine> -#include "qtquick2applicationviewer.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QtQuick2ApplicationViewer viewer; -#ifdef Q_OS_ANDROID - viewer.addImportPath(QString::fromLatin1("assets:/qml")); - viewer.engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib"))); -#else - viewer.addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml"))); -#endif - viewer.setSource(QUrl("qrc:/qml/quick2chartproperties/main.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml deleted file mode 100644 index c942b288..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "area series" - anchors.fill: parent - animationOptions: ChartView.SeriesAnimations - - property variant series: areaSeries - - AreaSeries { - id: areaSeries - name: "area 1" - - upperSeries: LineSeries { - XYPoint { x: 0; y: 1 } - XYPoint { x: 1; y: 1 } - XYPoint { x: 2; y: 3 } - XYPoint { x: 3; y: 3 } - XYPoint { x: 4; y: 2 } - XYPoint { x: 5; y: 0 } - XYPoint { x: 6; y: 2 } - XYPoint { x: 7; y: 1 } - XYPoint { x: 8; y: 2 } - XYPoint { x: 9; y: 1 } - XYPoint { x: 10; y: 3 } - XYPoint { x: 11; y: 3 } - } - lowerSeries: LineSeries { - XYPoint { x: 0; y: 0 } - XYPoint { x: 1; y: 0 } - XYPoint { x: 2; y: 0 } - XYPoint { x: 3; y: 0 } - XYPoint { x: 4; y: 0 } - XYPoint { x: 5; y: 0 } - XYPoint { x: 6; y: 0 } - XYPoint { x: 7; y: 0 } - XYPoint { x: 8; y: 0 } - XYPoint { x: 9; y: 0 } - XYPoint { x: 10; y: 0 } - XYPoint { x: 11; y: 0 } - } - - pointLabelsFormat: "@xPoint, @yPoint"; - - onNameChanged: console.log(name + ".onNameChanged: " + name); - onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible); - onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity); - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onSelected: console.log(name + ".onSelected"); - onColorChanged: console.log(name + ".onColorChanged: " + color); - onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor); - onBorderWidthChanged: console.log(name + ".onBorderChanged: " + borderWidth); -// onCountChanged: console.log(name + ".onCountChanged: " + count); - onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state); - onPointLabelsVisibilityChanged: console.log(name + ".onPointLabelsVisibilityChanged: " - + visible); - onPointLabelsFormatChanged: console.log(name + ".onPointLabelsFormatChanged: " - + format); - onPointLabelsFontChanged: console.log(name + ".onPointLabelsFontChanged: " - + font.family); - onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: " - + color); - } - - AreaSeries { - name: "area 2" - - upperSeries: LineSeries { - XYPoint { x: 0; y: 0.5 } - XYPoint { x: 1; y: 1.5 } - XYPoint { x: 2; y: 0.3 } - XYPoint { x: 3; y: 1.5 } - XYPoint { x: 4; y: 0.1 } - XYPoint { x: 5; y: 0.3 } - XYPoint { x: 6; y: 1.2 } - XYPoint { x: 7; y: 1.3 } - XYPoint { x: 8; y: 0.2 } - XYPoint { x: 9; y: 0.1 } - XYPoint { x: 10; y: 3.2 } - XYPoint { x: 11; y: 4.6 } - } - - onNameChanged: console.log(name + ".onNameChanged: " + name); - onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible); - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onSelected: console.log(name + ".onSelected"); - onColorChanged: console.log(name + ".onColorChanged: " + color); - onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml deleted file mode 100644 index 168dc957..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Flow { - id: flow - spacing: 5 - flow: Flow.TopToBottom - property variant series - - Button { - text: "visible" - onClicked: series.visible = !series.visible; - } - Button { - text: "opacity +" - onClicked: series.opacity += 0.1; - } - Button { - text: "opacity -" - onClicked: series.opacity -= 0.1; - } - Button { - text: "color" - onClicked: series.color = main.nextColor(); - } - Button { - text: "borderColor" - onClicked: series.borderColor = main.nextColor(); - } - Button { - text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : "" - onClicked: series.borderWidth += 0.5; - } - Button { - text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : "" - onClicked: series.borderWidth -= 0.5; - } - Button { - text: "point labels visible" - onClicked: series.pointLabelsVisible = !series.pointLabelsVisible; - } - Button { - text: "point labels format" - onClicked: { - if (series.pointLabelsFormat === "@xPoint, @yPoint") - series.pointLabelsFormat = "(@xPoint)" - else - series.pointLabelsFormat = "@xPoint, @yPoint" - } - } - Button { - text: "point labels font" - onClicked: { - if (series.pointLabelsFont.family === "Times") - series.pointLabelsFont.family = "Courier"; - else - series.pointLabelsFont.family = "Times"; - } - } - Button { - text: "point labels color" - onClicked: series.pointLabelsColor = main.nextColor(); - } - Button { - id: upperButton - text: "upper series" - unpressedColor: "#79bd8f" - onClicked: { - lineEditor.visible = true; - color = "#00a388"; - lowerButton.color = "#79bd8f"; - lineEditor.series = series.upperSeries; - } - } - Button { - id: lowerButton - text: "lower series" - unpressedColor: "#79bd8f" - onClicked: { - lineEditor.visible = true; - color = "#00a388"; - upperButton.color = "#79bd8f"; - lineEditor.series = series.lowerSeries; - } - } - LineEditor { - id: lineEditor - visible: false - } - - onSeriesChanged: lineEditor.series = series.upperSeries; -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml deleted file mode 100644 index 8a91cdb8..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "Bar series" - anchors.fill: parent - theme: ChartView.ChartThemeLight - legend.alignment: Qt.AlignBottom - animationOptions: ChartView.SeriesAnimations - - property variant series: mySeries - - - BarSeries { - id: mySeries - name: "bar" - labelsFormat: "@value"; - axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } - BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] - onClicked: console.log("barset.onClicked: " + index); - onHovered: console.log("barset.onHovered: " + status + " " + index); - onPenChanged: console.log("barset.onPenChanged: " + pen); - onBrushChanged: console.log("barset.onBrushChanged: " + brush); - onLabelChanged: console.log("barset.onLabelChanged: " + label); - onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); - onColorChanged: console.log("barset.onColorChanged: " + color); - onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); - onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); - onCountChanged: console.log("barset.onCountChanged: " + count); - onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); - onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); - onValueChanged: console.log("barset.onValuesChanged: " + index); - } - BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } - BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } - - onNameChanged: console.log("barSeries.onNameChanged: " + series.name); - onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity); - onClicked: console.log("barSeries.onClicked: " + barset + " " + index); - onHovered: console.log("barSeries.onHovered: " + barset + " " + status - + " " + index); - onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible); - onCountChanged: console.log("barSeries.onCountChanged: " + count); - onLabelsFormatChanged: console.log("barSeries.onLabelsFormatChanged: " + format); - onLabelsPositionChanged: console.log("barSeries.onLabelsPositionChanged: " + series.labelsPosition); - - function changeLabelsPosition() { - if (labelsPosition === BarSeries.LabelsCenter) - labelsPosition = BarSeries.LabelsInsideEnd; - else - labelsPosition = BarSeries.LabelsCenter; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml deleted file mode 100644 index cdd847a5..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Row { - anchors.fill: parent - spacing: 5 - property variant series - - // buttons for selecting the edited object: series, barset or label - Flow { - spacing: 5 - flow: Flow.TopToBottom - Button { - id: seriesButton - text: "series" - unpressedColor: "#79bd8f" - onClicked: { - seriesFlow.visible = true; - setFlow.visible = false; - labelsFlow.visible = false; - color = "#00a388"; - setButton.color = "#79bd8f"; - labelButton.color = "#79bd8f"; - } - } - Button { - id: setButton - text: "BarSet" - unpressedColor: "#79bd8f" - onClicked: { - seriesFlow.visible = false; - setFlow.visible = true; - labelsFlow.visible = false; - color = "#00a388"; - seriesButton.color = "#79bd8f"; - labelButton.color = "#79bd8f"; - } - } - Button { - id: labelButton - text: "label" - unpressedColor: "#79bd8f" - onClicked: { - seriesFlow.visible = false; - setFlow.visible = false; - labelsFlow.visible = true; - color = "#00a388"; - seriesButton.color = "#79bd8f"; - setButton.color = "#79bd8f"; - } - } - } - - // Buttons for editing series - Flow { - id: seriesFlow - spacing: 5 - flow: Flow.TopToBottom - visible: false - - Button { - text: "visible" - onClicked: series.visible = !series.visible; - } - Button { - text: "opacity +" - onClicked: series.opacity += 0.1; - } - Button { - text: "opacity -" - onClicked: series.opacity -= 0.1; - } - Button { - text: "bar width +" - onClicked: series.barWidth += 0.1; - } - Button { - text: "bar width -" - onClicked: series.barWidth -= 0.1; - } - } - - // Buttons for editing sets - Flow { - id: setFlow - spacing: 5 - flow: Flow.TopToBottom - visible: false - - Button { - text: "append set" - onClicked: { - var count = series.count; - series.append("set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]); - } - } - Button { - text: "insert set" - onClicked: { - var count = series.count; - series.insert(count - 1, "set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]); - } - } - Button { - text: "remove set" - onClicked: series.remove(series.at(series.count - 1)); - } - Button { - text: "clear sets" - onClicked: series.clear(); - } - - Button { - text: "set 1 append" - onClicked: series.at(0).append(series.at(0).count + 1); - } - Button { - text: "set 1 replace" - onClicked: series.at(0).replace(series.at(0).count - 1, series.at(0).at(series.at(0).count - 1) + 1.5); - } - Button { - text: "set 1 remove" - onClicked: series.at(0).remove(series.at(0).count - 1); - } - - Button { - text: "set 1 color" - onClicked: series.at(0).color = main.nextColor(); - } - Button { - text: "set 1 border color" - onClicked: series.at(0).borderColor = main.nextColor(); - } - Button { - text: "set 1 borderWidth +" - onClicked: series.at(0).borderWidth += 0.5; - } - Button { - text: "set 1 borderWidth -" - onClicked: series.at(0).borderWidth -= 0.5; - } - } - - - Flow { - id: labelsFlow - spacing: 5 - flow: Flow.TopToBottom - visible: false - - Button { - text: "labels visible" - onClicked: series.labelsVisible = !series.labelsVisible; - } - Button { - text: "labels format" - onClicked: { - if (series.labelsFormat === "@value") - series.labelsFormat = "@value%" - else - series.labelsFormat = "@value" - } - } - Button { - text: "labels position" - onClicked: series.changeLabelsPosition(); - } - Button { - text: "set 1 label color" - onClicked: series.at(0).labelColor = main.nextColor(); - } - FontEditor { - id: fontEditor - fontDescription: "label" - function editedFont() { - return series.at(0).labelFont; - } - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml b/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml deleted file mode 100644 index 61df081d..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Rectangle { - id: button - height: 25 - width: 140 - color: unpressedColor - radius: 5 - property color unpressedColor: "#afafaf" - - property string text: "button" - signal clicked - - Text { - id: buttonText - anchors.centerIn: parent - text: button.text - } - - MouseArea { - anchors.fill: parent - onClicked: { - button.clicked(); - } - onPressedChanged: { - if (pressed) { - button.color = "#efefef"; - } else { - button.color = unpressedColor; - } - } - onPressAndHold: { - repeatTimer.start(); - } - onReleased: { - repeatTimer.stop(); - } - } - - Timer { - id: repeatTimer - interval: 140 - repeat: true - triggeredOnStart: false - running: false - onTriggered: { - button.clicked(); - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml deleted file mode 100644 index 3183c57f..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.3 - -ChartView { - id: chartView - title: "Chart Title" - anchors.fill: parent - property variant chart: chartView - - LineSeries { - name: "line" - XYPoint { x: 0; y: 0 } - XYPoint { x: 1.1; y: 2.1 } - XYPoint { x: 1.9; y: 3.3 } - XYPoint { x: 2.1; y: 2.1 } - XYPoint { x: 2.9; y: 4.9 } - XYPoint { x: 3.4; y: 3.0 } - XYPoint { x: 4.1; y: 3.3 } - } - - onVisibleChanged: console.log("chart.onVisibleChanged: " + visible); - onTitleColorChanged: console.log("chart.onTitleColorChanged: " + color); - onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + chart.backgroundColor); - onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled); - onBackgroundRoundnessChanged: console.log("chart.onBackgroundRoundnessChanged: " + diameter); - onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name); - onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name); - onPlotAreaColorChanged: console.log("chart.plotAreaColorChanged: " + chart.plotAreaColor); - - legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible); - legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible); - legend.onColorChanged: console.log("legend.onColorChanged: " + color); - legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color); - legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color); - legend.onReverseMarkersChanged: console.log("legend.onReverseMarkersChanged: " - + chart.legend.reverseMarkers) - margins.onTopChanged: console.log("chart.margins.onTopChanged: " + top ); - margins.onBottomChanged: console.log("chart.margins.onBottomChanged: " + bottom); - margins.onLeftChanged: console.log("chart.margins.onLeftChanged: " + left); - margins.onRightChanged: console.log("chart.margins.onRightChanged: " + right); - onPlotAreaChanged: { - console.log("chart.onPlotAreaChanged, width: " + chartView.plotArea.width - + " height: " + chartView.plotArea.height - + " y: " + chartView.plotArea.y - + " x: " + chartView.plotArea.x); - marginVisualizer.opacity = 1.0; - } - - ValueAxis{ - onColorChanged: console.log("axisX.onColorChanged: " + color); - onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible); - onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color); - onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible); - onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible); - onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible); - onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color); - onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color); - onMinChanged: console.log("axisX.onMinChanged: " + min); - onMaxChanged: console.log("axisX.onMaxChanged: " + max); - } - - ValueAxis{ - onColorChanged: console.log("axisY.onColorChanged: " + color); - onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible); - onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color); - onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible); - onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible); - onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible); - onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color); - onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color); - onMinChanged: console.log("axisY.onMinChanged: " + min); - onMaxChanged: console.log("axisY.onMaxChanged: " + max); - } - - Rectangle { - id: marginVisualizer - color: "transparent" - border.color: "red" - anchors.fill: parent - anchors.topMargin: chartView.minimumMargins.top - anchors.bottomMargin: chartView.minimumMargins.bottom - anchors.leftMargin: chartView.minimumMargins.left - anchors.rightMargin: chartView.minimumMargins.right - opacity: 0.0 - onOpacityChanged: if (opacity > 0.9) opacity = 0.0; - Behavior on opacity { - NumberAnimation { duration: 800 } - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml deleted file mode 100644 index 87139f35..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Item { - id: chartEditor - property variant chart - onChartChanged: { - if (loader.item != undefined) - loader.item.chart = chart; - } - - function selectButton(button) { - chartButton.color = "#79bd8f"; - titleButton.color = "#79bd8f"; - legendButton.color = "#79bd8f"; - axisXButton.color = "#79bd8f"; - axisYButton.color = "#79bd8f"; - seriesButton.color = "#79bd8f"; - button.color = "#00a388"; - } - - Flow { - id: selectorFlow - anchors.top: parent.top - height: 90 - anchors.left: parent.left - anchors.right: parent.right - spacing: 5 - flow: Flow.TopToBottom - - Button { - id: chartButton - text: "Chart properties" - unpressedColor: "#79bd8f" - onClicked: { - selectButton(chartButton); - loader.source = "ChartEditorProperties.qml"; - loader.item.chart = chart; - } - } - Button { - id: titleButton - text: "Title properties" - unpressedColor: "#79bd8f" - onClicked: { - selectButton(titleButton); - loader.source = "ChartEditorTitle.qml"; - loader.item.chart = chart; - } - } - Button { - id: legendButton - text: "Legend properties" - unpressedColor: "#79bd8f" - onClicked: { - selectButton(legendButton); - loader.source = "ChartEditorLegend.qml"; - loader.item.chartLegend = chart.legend; - } - } - Button { - id: axisXButton - text: "Axis X properties" - unpressedColor: "#79bd8f" - onClicked: { - selectButton(axisXButton); - loader.source = "ChartEditorAxis.qml"; - loader.item.axis = chart.axisX(); - } - } - Button { - id: axisYButton - text: "Axis Y properties" - unpressedColor: "#79bd8f" - onClicked: { - selectButton(axisYButton); - loader.source = "ChartEditorAxis.qml"; - loader.item.axis = chart.axisY(); - } - } - Button { - id: seriesButton - text: "Series" - unpressedColor: "#79bd8f" - onClicked: { - selectButton(seriesButton); - loader.source = "ChartEditorSeries.qml"; - loader.item.chart = chart; - } - } - } - - Loader { - id: loader - anchors.top: selectorFlow.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml deleted file mode 100644 index 0c6d8dce..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Row { - anchors.fill: parent - spacing: 5 - property variant axis - - Flow { - spacing: 5 - flow: Flow.TopToBottom - height: parent.height - - Button { - text: "axis visible" - onClicked: axis.visible = !axis.visible; - } - Button { - text: "axis line visible" - onClicked: axis.lineVisible = !axis.lineVisible; - } - Button { - text: "axis color" - onClicked: axis.color = main.nextColor(); - } - Button { - text: "axis labels visible" - onClicked: axis.labelsVisible = !axis.labelsVisible; - } - Button { - text: "axis labels angle +" - onClicked: axis.labelsAngle += 5; - } - Button { - text: "axis labels angle -" - onClicked: axis.labelsAngle -= 5; - } - Button { - text: "axis labels color" - onClicked: axis.labelsColor = main.nextColor(); - } - Button { - text: "axis grid visible" - onClicked: axis.gridVisible = !axis.gridVisible; - } - Button { - text: "axis shades visible" - onClicked: axis.shadesVisible = !axis.shadesVisible; - } - Button { - text: "axis shades color" - onClicked: axis.shadesColor = main.nextColor(); - } - Button { - text: "axis shades bcolor" - onClicked: axis.shadesBorderColor = main.nextColor(); - } - Button { - text: "axis title text" - onClicked: axis.titleText = axis.titleText + "X"; - } - Button { - text: "axis title visible" - onClicked: axis.titleVisible = !axis.titleVisible; - } - Button { - text: "axis max +" - onClicked: axis.max += 0.1; - } - Button { - text: "axis max -" - onClicked: axis.max -= 0.1; - } - Button { - text: "axis min +" - onClicked: axis.min += 0.1; - } - Button { - text: "axis min -" - onClicked: axis.min -= 0.1; - } - Button { - text: "axis tick count +" - onClicked: axis.tickCount++; - } - Button { - text: "axis tick count -" - - onClicked: axis.tickCount--; - } - Button { - text: "axis nice nmb" - onClicked: axis.niceNumbersEnabled = !axis.niceNumbersEnabled; - } - - FontEditor { - id: fontEditor - fontDescription: "axis" - function editedFont() { - return axis.labelsFont; - } - } - - FontEditor { - id: titleFontEditor - fontDescription: "title" - function editedFont() { - return axis.titleFont; - } - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml deleted file mode 100644 index 24ffd9ef..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Row { - anchors.fill: parent - spacing: 5 - property variant chartLegend - - Flow { - spacing: 5 - flow: Flow.TopToBottom - - Button { - text: "legend visible" - onClicked: chartLegend.visible = !chartLegend.visible; - } - Button { - text: "legend bckgrd visible" - onClicked: chartLegend.backgroundVisible = !chartLegend.backgroundVisible; - } - Button { - text: "legend color" - onClicked: chartLegend.color = main.nextColor(); - } - Button { - text: "legend border color" - onClicked: chartLegend.borderColor = main.nextColor(); - } - Button { - text: "legend label color" - onClicked: chartLegend.labelColor = main.nextColor(); - } - Button { - text: "legend top" - onClicked: chartLegend.alignment = Qt.AlignTop; - } - Button { - text: "legend bottom" - onClicked: chartLegend.alignment = Qt.AlignBottom; - } - Button { - text: "legend left" - onClicked: chartLegend.alignment = Qt.AlignLeft; - } - Button { - text: "legend right" - onClicked: chartLegend.alignment = Qt.AlignRight; - } - Button { - text: "legend use reverse order" - onClicked: chartLegend.reverseMarkers = !chartLegend.reverseMarkers; - } - } - - FontEditor { - fontDescription: "legend" - function editedFont() { - return chartLegend.font; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml deleted file mode 100644 index d172e4d8..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Flow { - anchors.fill: parent - property variant chart - 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: "plot area color" - onClicked: chart.plotAreaColor = main.nextColor(); - } - Button { - text: "drop shadow enabled" - onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled; - } - Button { - text: "roundness" - onClicked: chart.backgroundRoundness++; - } - 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: "top margin +" - onClicked: chart.margins.top += 5; - } - Button { - text: "top margin -" - onClicked: chart.margins.top -= 5; - } - Button { - text: "bottom margin +" - onClicked: chart.margins.bottom += 5; - } - Button { - text: "bottom margin -" - onClicked: chart.margins.bottom -= 5; - } - Button { - text: "left margin +" - onClicked: chart.margins.left += 5; - } - Button { - text: "left margin -" - onClicked: chart.margins.left -= 5; - } - Button { - text: "right margin +" - onClicked: chart.margins.right += 5; - } - Button { - text: "right margin -" - onClicked: chart.margins.right -= 5; - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml deleted file mode 100644 index 06b8618b..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.1 - -Flow { - anchors.fill: parent - property variant chart - flow: Flow.TopToBottom - spacing: 5 - - Button { - text: "add line" - onClicked: addXYSeries(ChartView.SeriesTypeLine, "line"); - } - Button { - text: "add spline" - onClicked: addXYSeries(ChartView.SeriesTypeSpline, "spline"); - } - Button { - text: "add scatter" - onClicked: addXYSeries(ChartView.SeriesTypeScatter, "scatter"); - } - Button { - text: "remove last" - onClicked: { - if (chart.count > 0) - chart.removeSeries(chart.series(chart.count - 1)); - else - chart.removeSeries(0); - } - } - Button { - text: "remove all" - onClicked: chart.removeAllSeries(); - } - - function addXYSeries(type, name) { - var series = chart.createSeries(type, name + " " + chart.count); - for (var i = chart.axisX().min; i < chart.axisX().max; i++) { - var y = Math.random() * (chart.axisY().max - chart.axisY().min) + chart.axisY().min; - var x = Math.random() + i; - series.append(x, y); - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml deleted file mode 100644 index 61b4365f..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.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/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml deleted file mode 100644 index 3531597f..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Flow { - flow: Flow.TopToBottom - spacing: 5 - property string fontDescription: "" - - Button { - text: fontDescription + " bold" - onClicked: editedFont().bold = !editedFont().bold; - } - Button { - text: fontDescription + " capitalization" - onClicked: editedFont().capitalization++; - } - Button { - text: fontDescription + " font family" - onClicked: editedFont().family = "courier"; - } - Button { - text: fontDescription + " font italic" - onClicked: editedFont().italic = !editedFont().italic; - } - Button { - text: fontDescription + " letterSpacing +" - onClicked: editedFont().letterSpacing++; - } - Button { - text: fontDescription + " letterSpacing -" - onClicked: editedFont().letterSpacing--; - } - Button { - text: fontDescription + " pixelSize +" - onClicked: editedFont().pixelSize++; - } - Button { - text: fontDescription + " pixelSize -" - onClicked: editedFont().pixelSize--; - } - Button { - text: fontDescription + " pointSize +" - onClicked: editedFont().pointSize++; - } - Button { - text: fontDescription + " pointSize -" - onClicked: editedFont().pointSize--; - } - Button { - text: fontDescription + " strikeout" - onClicked: editedFont().strikeout = !editedFont().strikeout; - } - Button { - text: fontDescription + " underline" - onClicked: editedFont().underline = !editedFont().underline; - } - Button { - text: fontDescription + " weight +" - onClicked: editedFont().weight++; - } - Button { - text: fontDescription + " weight -" - onClicked: editedFont().weight--; - } - Button { - text: fontDescription + " wordSpacing +" - onClicked: editedFont().wordSpacing++; - } - Button { - text: fontDescription + " wordSpacing -" - onClicked: editedFont().wordSpacing--; - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml deleted file mode 100644 index 342995cf..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "Bar series" - anchors.fill: parent - theme: ChartView.ChartThemeLight - legend.alignment: Qt.AlignBottom - animationOptions: ChartView.SeriesAnimations - - property variant series: mySeries - - HorizontalBarSeries { - id: mySeries - name: "bar" - labelsFormat: "@value"; - axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } - BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] - onClicked: console.log("barset.onClicked: " + index); - onHovered: console.log("barset.onHovered: " + status + " " + index); - onPenChanged: console.log("barset.onPenChanged: " + pen); - onBrushChanged: console.log("barset.onBrushChanged: " + brush); - onLabelChanged: console.log("barset.onLabelChanged: " + label); - onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); - onColorChanged: console.log("barset.onColorChanged: " + color); - onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); - onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); - onCountChanged: console.log("barset.onCountChanged: " + count); - onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); - onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); - onValueChanged: console.log("barset.onValuesChanged: " + index); - } - BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } - BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } - - onNameChanged: console.log("horizontalBarSeries.onNameChanged: " + series.name); - onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity); - onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index); - onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " " - + status + " " + index); - onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); - onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count); - onLabelsFormatChanged: console.log("horizontalBarSeries.onLabelsFormatChanged: " - + format); - onLabelsPositionChanged: console.log("horizontalBarSeries.onLabelsPositionChanged: " - + series.labelsPosition); - - function changeLabelsPosition() { - if (labelsPosition === BarSeries.LabelsCenter) - labelsPosition = BarSeries.LabelsInsideEnd; - else - labelsPosition = BarSeries.LabelsCenter; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml deleted file mode 100644 index 0ef7e17a..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "Percent bar series" - anchors.fill: parent - theme: ChartView.ChartThemeLight - legend.alignment: Qt.AlignBottom - animationOptions: ChartView.SeriesAnimations - - property variant series: mySeries - - HorizontalPercentBarSeries { - id: mySeries - name: "bar" - labelsFormat: "@value"; - axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } - BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] - onClicked: console.log("barset.onClicked: " + index); - onHovered: console.log("barset.onHovered: " + status + " " + index); - onPenChanged: console.log("barset.onPenChanged: " + pen); - onBrushChanged: console.log("barset.onBrushChanged: " + brush); - onLabelChanged: console.log("barset.onLabelChanged: " + label); - onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); - onColorChanged: console.log("barset.onColorChanged: " + color); - onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); - onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); - onCountChanged: console.log("barset.onCountChanged: " + count); - onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); - onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); - onValueChanged: console.log("barset.onValuesChanged: " + index); - } - BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } - BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } - - onNameChanged: console.log("horizontalPercentBarSeries.onNameChanged: " + series.name); - onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity); - onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index); - onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset - + " " + status + " " + index); - onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); - onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count); - onLabelsFormatChanged: console.log( - "horizontalPercentBarSeries.onLabelsFormatChanged: " - + format); - onLabelsPositionChanged: console.log( - "horizontalPercentBarSeries.onLabelsPositionChanged: " - + series.labelsPosition); - - function changeLabelsPosition() { - if (labelsPosition === BarSeries.LabelsCenter) - labelsPosition = BarSeries.LabelsInsideEnd; - else - labelsPosition = BarSeries.LabelsCenter; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml deleted file mode 100644 index c1ef51b8..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "Stacked bar series" - anchors.fill: parent - theme: ChartView.ChartThemeLight - legend.alignment: Qt.AlignBottom - animationOptions: ChartView.SeriesAnimations - - property variant series: mySeries - - HorizontalStackedBarSeries { - id: mySeries - name: "bar" - labelsFormat: "@value"; - axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } - BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] - onClicked: console.log("barset.onClicked: " + index); - onHovered: console.log("barset.onHovered: " + status + " " + index); - onPenChanged: console.log("barset.onPenChanged: " + pen); - onBrushChanged: console.log("barset.onBrushChanged: " + brush); - onLabelChanged: console.log("barset.onLabelChanged: " + label); - onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); - onColorChanged: console.log("barset.onColorChanged: " + color); - onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); - onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); - onCountChanged: console.log("barset.onCountChanged: " + count); - onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); - onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); - onValueChanged: console.log("barset.onValuesChanged: " + index); - } - BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } - BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } - - onNameChanged: console.log("horizontalStackedBarSeries.onNameChanged: " + series.name); - onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity); - onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index); - onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset - + " " + status + " " + index); - onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); - onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count); - onLabelsFormatChanged: console.log( - "horizontalStackedBarSeries.onLabelsFormatChanged: " - + format); - onLabelsPositionChanged: console.log( - "horizontalStackedBarSeries.onLabelsPositionChanged: " - + series.labelsPosition); - - function changeLabelsPosition() { - if (labelsPosition === BarSeries.LabelsCenter) - labelsPosition = BarSeries.LabelsInsideEnd; - else - labelsPosition = BarSeries.LabelsCenter; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml deleted file mode 100644 index 3190ac35..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - property variant series: lineSeries - - title: "line series" - anchors.fill: parent - animationOptions: ChartView.SeriesAnimations - - LineSeries { - id: lineSeries - name: "line 1" - XYPoint { x: 0; y: 0 } - XYPoint { x: 1.1; y: 2.1 } - XYPoint { x: 1.9; y: 3.3 } - XYPoint { x: 2.1; y: 2.1 } - XYPoint { x: 2.9; y: 4.9 } - XYPoint { x: 3.4; y: 3.0 } - XYPoint { x: 4.1; y: 3.3 } - - pointLabelsFormat: "@xPoint, @yPoint"; - - onNameChanged: console.log("lineSeries.onNameChanged: " + name); - onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible); - onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity); - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onPointReplaced: console.log("lineSeries.onPointReplaced: " + index); - onPointRemoved: console.log("lineSeries.onPointRemoved: " + index); - onPointAdded: console.log("lineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); - onColorChanged: console.log("lineSeries.onColorChanged: " + color); - onWidthChanged: console.log("lineSeries.onWidthChanged: " + width); - onStyleChanged: console.log("lineSeries.onStyleChanged: " + style); - onCapStyleChanged: console.log("lineSeries.onCapStyleChanged: " + capStyle); - onCountChanged: console.log("lineSeries.onCountChanged: " + count); - onHovered: console.log("lineSeries.onHovered:" + point.x + "," + point.y + " " + state); - onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: " - + visible); - onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: " - + format); - onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: " - + font.family); - onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: " - + color); - } - - LineSeries { - name: "line 2" - XYPoint { x: 1.1; y: 1.1 } - XYPoint { x: 1.9; y: 2.3 } - XYPoint { x: 2.1; y: 1.1 } - XYPoint { x: 2.9; y: 3.9 } - XYPoint { x: 3.4; y: 2.0 } - XYPoint { x: 4.1; y: 2.3 } - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml deleted file mode 100644 index 7960b4a1..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - - -Flow { - id: flow - spacing: 5 - flow: Flow.TopToBottom - property variant series - - Button { - text: "visible" - onClicked: series.visible = !series.visible; - } - Button { - text: "opacity +" - onClicked: series.opacity += 0.1; - } - Button { - text: "opacity -" - onClicked: series.opacity -= 0.1; - } - Button { - text: "color" - onClicked: series.color = main.nextColor(); - } - Button { - text: series != undefined ? "width + (" + series.width + ")" : "" - onClicked: series.width += 0.5; - } - Button { - text: series != undefined ? "width - (" + series.width + ")" : "" - onClicked: series.width -= 0.5; - } - Button { - text: series != undefined ? "style + (" + series.style + ")" : "" - onClicked: series.style++; - } - Button { - text: series != undefined ? "style - (" + series.style + ")" : "" - onClicked: series.style--; - } - Button { - text: series != undefined ? "cap style + (" + series.capStyle + ")" : "" - onClicked: series.capStyle++; - } - Button { - text: series != undefined ? "cap style - (" +series.capStyle + ")" : "" - onClicked: series.capStyle--; - } - Button { - text: "points visible" - onClicked: series.pointsVisible = !series.pointsVisible; - } - Button { - text: "point labels visible" - onClicked: series.pointLabelsVisible = !series.pointLabelsVisible; - } - Button { - text: "point labels format" - onClicked: { - if (series.pointLabelsFormat === "@xPoint, @yPoint") - series.pointLabelsFormat = "(@xPoint)" - else - series.pointLabelsFormat = "@xPoint, @yPoint" - } - } - Button { - text: "point labels font" - onClicked: { - if (series.pointLabelsFont.family === "Times") - series.pointLabelsFont.family = "Courier"; - else - series.pointLabelsFont.family = "Times"; - } - } - Button { - text: "point labels color" - onClicked: series.pointLabelsColor = main.nextColor(); - } - Button { - text: "append point" - onClicked: series.append(series.count - 1, series.count - 1); - } - Button { - text: "replace point" - onClicked: { - var xyPoint = series.at(series.count - 1); - series.replace(series.count - 1, xyPoint.x, xyPoint.y + 0.1); - } - } - Button { - text: "remove point" - onClicked: series.remove(series.count - 1); - } - Button { - text: "insert point" - onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2); - } - Button { - text: "clear" - onClicked: series.clear(); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml deleted file mode 100644 index 822a1839..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "Percent bar series" - anchors.fill: parent - theme: ChartView.ChartThemeLight - legend.alignment: Qt.AlignBottom - animationOptions: ChartView.SeriesAnimations - - property variant series: mySeries - - PercentBarSeries { - id: mySeries - name: "bar" - labelsFormat: "@value"; - axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } - - BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] - onClicked: console.log("barset.onClicked: " + index); - onHovered: console.log("barset.onHovered: " + status + " " + index); - onPenChanged: console.log("barset.onPenChanged: " + pen); - onBrushChanged: console.log("barset.onBrushChanged: " + brush); - onLabelChanged: console.log("barset.onLabelChanged: " + label); - onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); - onColorChanged: console.log("barset.onColorChanged: " + color); - onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); - onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); - onCountChanged: console.log("barset.onCountChanged: " + count); - onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); - onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); - onValueChanged: console.log("barset.onValuesChanged: " + index); - } - BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } - BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } - - onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name); - onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity); - onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index); - onHovered: console.log("percentBarSeries.onHovered: " + barset - + " " + status + " " + index); - onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); - onCountChanged: console.log("percentBarSeries.onCountChanged: " + count); - onLabelsFormatChanged: console.log("percentBarSeries.onLabelsFormatChanged: " - + format); - onLabelsPositionChanged: console.log("percentBarSeries.onLabelsPositionChanged: " - + series.labelsPosition); - - function changeLabelsPosition() { - if (labelsPosition === BarSeries.LabelsCenter) - labelsPosition = BarSeries.LabelsInsideEnd; - else - labelsPosition = BarSeries.LabelsCenter; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml deleted file mode 100644 index 6ee1ac91..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.1 - -ChartView { - id: chart - title: "pie series" - animationOptions: ChartView.SeriesAnimations - - property variant series: pieSeries - - PieSeries { - id: pieSeries - name: "pie" - PieSlice { label: "slice1"; value: 11; - onValueChanged: console.log("slice.onValueChanged: " + value); - onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + labelVisible); - onPenChanged: console.log("slice.onPenChanged: " + pen); - onBorderColorChanged: console.log("slice.onBorderColorChanged: " + borderColor); - onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + borderWidth); - onBrushChanged: console.log("slice.onBrushChanged: " + brush); - onColorChanged: console.log("slice.onColorChanged: " + color); - onLabelColorChanged: console.log("slice.onLabelColorChanged: " + labelColor); - onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("slice.onLabelFontChanged: " + labelFont); - onPercentageChanged: console.log("slice.onPercentageChanged: " + percentage); - onStartAngleChanged: console.log("slice.onStartAngleChanged: " + startAngle); - onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + angleSpan); - onClicked: console.log("slice.onClicked: " + label); - onHovered: console.log("slice.onHovered: " + state); - } - PieSlice { label: "slice2"; value: 22 } - PieSlice { label: "slice3"; value: 33 } - PieSlice { label: "slice4"; value: 44 } - - onNameChanged: console.log("pieSeries.onNameChanged: " + name); - onVisibleChanged: console.log("pieSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("pieSeries.onOpacityChanged: " + opacity); - onClicked: console.log("pieSeries.onClicked: " + slice.label); - onHovered: console.log("pieSeries.onHovered: " + slice.label); - onAdded: console.log("pieSeries.onAdded: " + slices); - onSliceAdded: console.log("pieSeries.onSliceAdded: " + slice.label); - onRemoved: console.log("pieSeries.onRemoved: " + slices); - onSliceRemoved: console.log("pieSeries.onSliceRemoved: " + slice.label); - onCountChanged: console.log("pieSeries.onCountChanged: " + count); - onSumChanged: console.log("pieSeries.onSumChanged: " + sum); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml deleted file mode 100644 index 09464e0f..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.1 - -Row { - anchors.fill: parent - spacing: 5 - property variant series - property int sliceIndex: 0 - - // buttons for selecting the edited object: series, slice or label - Flow { - spacing: 5 - flow: Flow.TopToBottom - Button { - id: seriesButton - text: "series" - unpressedColor: "#79bd8f" - onClicked: { - seriesFlow.visible = true; - slicesFlow.visible = false; - labelsFlow.visible = false; - color = "#00a388"; - sliceButton.color = "#79bd8f"; - labelButton.color = "#79bd8f"; - } - } - Button { - id: sliceButton - text: "slice" - unpressedColor: "#79bd8f" - onClicked: { - seriesFlow.visible = false; - slicesFlow.visible = true; - labelsFlow.visible = false; - color = "#00a388"; - seriesButton.color = "#79bd8f"; - labelButton.color = "#79bd8f"; - } - } - Button { - id: labelButton - text: "label" - unpressedColor: "#79bd8f" - onClicked: { - seriesFlow.visible = false; - slicesFlow.visible = false; - labelsFlow.visible = true; - color = "#00a388"; - seriesButton.color = "#79bd8f"; - sliceButton.color = "#79bd8f"; - } - } - } - - // Buttons for editing series - Flow { - id: seriesFlow - spacing: 5 - flow: Flow.TopToBottom - visible: false - Button { - text: "visible" - onClicked: series.visible = !series.visible; - } - Button { - text: "series opacity +" - onClicked: series.opacity += 0.1; - } - Button { - text: "series opacity -" - onClicked: series.opacity -= 0.1; - } - Button { - text: "series hpos +" - onClicked: series.horizontalPosition += 0.1; - } - Button { - text: "series hpos -" - onClicked: series.horizontalPosition -= 0.1; - } - Button { - text: "series vpos +" - onClicked: series.verticalPosition += 0.1; - } - Button { - text: "series vpos -" - onClicked: series.verticalPosition -= 0.1; - } - Button { - text: "series size +" - onClicked: series.size += 0.1; - } - Button { - text: "series size -" - onClicked: series.size -= 0.1; - } - Button { - text: "series start angle +" - onClicked: series.startAngle += 1.1; - } - Button { - text: "series start angle -" - onClicked: series.startAngle -= 1.1; - } - Button { - text: "series end angle +" - onClicked: series.endAngle += 1.1; - } - Button { - text: "series end angle -" - onClicked: series.endAngle -= 1.1; - } - } - - // Buttons for editing slices - Flow { - id: slicesFlow - spacing: 5 - flow: Flow.TopToBottom - visible: false - - Button { - text: "append slice" - onClicked: series.append("slice" + (series.count + 1), 3.0); - } - Button { - text: "remove slice" - onClicked: series.remove(series.at(series.count - 1)); - } - Button { - text: "slice color" - onClicked: series.at(sliceIndex).color = main.nextColor(); - } - Button { - text: "slice border color" - onClicked: series.at(sliceIndex).borderColor = main.nextColor(); - } - Button { - text: "slice border width +" - onClicked: series.at(sliceIndex).borderWidth++; - } - Button { - text: "slice border width -" - onClicked: series.at(sliceIndex).borderWidth--; - } - Button { - text: "slice exploded" - onClicked: series.at(sliceIndex).exploded = !series.at(sliceIndex).exploded; - } - Button { - text: "slice explode dist +" - onClicked: series.at(sliceIndex).explodeDistanceFactor += 0.1; - } - Button { - text: "slice explode dist -" - onClicked: series.at(sliceIndex).explodeDistanceFactor -= 0.1; - } - } - - // Buttons for editing labels - Flow { - id: labelsFlow - spacing: 5 - flow: Flow.TopToBottom - visible: false - - Button { - text: "label visible" - onClicked: series.at(sliceIndex).labelVisible = !series.at(sliceIndex).labelVisible; - } - Button { - text: "LabelInsideNormal" - onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideNormal; - } - Button { - text: "LabelInsideHorizontal" - onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideHorizontal; - } - Button { - text: "LabelInsideTangential" - onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelInsideTangential; - } - Button { - text: "LabelOutside" - onClicked: series.at(sliceIndex).labelPosition = PieSlice.LabelOutside; - } - Button { - text: "label arm len +" - onClicked: series.at(sliceIndex).labelArmLengthFactor += 0.1; - } - Button { - text: "label arm len -" - onClicked: series.at(sliceIndex).labelArmLengthFactor -= 0.1; - } - Button { - text: "slice label color" - onClicked: series.at(sliceIndex).labelColor = main.nextColor(); - } - - FontEditor { - id: fontEditor - fontDescription: "label" - function editedFont() { - return series.at(sliceIndex).labelFont; - } - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml deleted file mode 100644 index 64785d2b..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "scatter series" - property variant series: scatterSeries - animationOptions: ChartView.SeriesAnimations - - ScatterSeries { - id: scatterSeries - name: "scatter 1" - XYPoint { x: 1.5; y: 1.5 } - XYPoint { x: 1.5; y: 1.6 } - XYPoint { x: 1.57; y: 1.55 } - XYPoint { x: 1.8; y: 1.8 } - XYPoint { x: 1.9; y: 1.6 } - XYPoint { x: 2.1; y: 1.3 } - XYPoint { x: 2.5; y: 2.1 } - - pointLabelsFormat: "@xPoint, @yPoint"; - - onNameChanged: console.log("scatterSeries.onNameChanged: " + name); - onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible); - onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity); - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); - onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index); - onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index); - onPointAdded: console.log("scatterSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); - onColorChanged: console.log("scatterSeries.onColorChanged: " + color); - onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor); - onBorderWidthChanged: console.log("scatterSeries.onBorderChanged: " + borderWidth); - onCountChanged: console.log("scatterSeries.onCountChanged: " + count); - onPointLabelsVisibilityChanged: console.log("lineSeries.onPointLabelsVisibilityChanged: " - + visible); - onPointLabelsFormatChanged: console.log("lineSeries.onPointLabelsFormatChanged: " - + format); - onPointLabelsFontChanged: console.log("lineSeries.onPointLabelsFontChanged: " - + font.family); - onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: " - + color); - } - - ScatterSeries { - name: "scatter2" - XYPoint { x: 2.0; y: 2.0 } - XYPoint { x: 2.0; y: 2.1 } - XYPoint { x: 2.07; y: 2.05 } - XYPoint { x: 2.2; y: 2.9 } - XYPoint { x: 2.4; y: 2.7 } - XYPoint { x: 2.67; y: 2.65 } - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml deleted file mode 100644 index 23afdb75..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Flow { - id: flow - spacing: 5 - flow: Flow.TopToBottom - property variant series - - Button { - text: "visible" - onClicked: series.visible = !series.visible; - } - Button { - text: "opacity +" - onClicked: series.opacity += 0.1; - } - Button { - text: "opacity -" - onClicked: series.opacity -= 0.1; - } - Button { - text: "color" - onClicked: series.color = main.nextColor(); - } - Button { - text: "borderColor" - onClicked: series.borderColor = main.nextColor(); - } - Button { - text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : "" - onClicked: series.borderWidth += 0.5; - } - Button { - text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : "" - onClicked: series.borderWidth -= 0.5; - } - Button { - text: "markerSize +" - onClicked: series.markerSize += 1.0; - } - Button { - text: "markerSize -" - onClicked: series.markerSize -= 1.0; - } - Button { - text: "markerShape" - onClicked: series.markerShape = ((series.markerShape + 1) % 2); - } - Button { - text: "point labels visible" - onClicked: series.pointLabelsVisible = !series.pointLabelsVisible; - } - Button { - text: "point labels format" - onClicked: { - if (series.pointLabelsFormat === "@xPoint, @yPoint") - series.pointLabelsFormat = "(@xPoint)" - else - series.pointLabelsFormat = "@xPoint, @yPoint" - } - } - Button { - text: "point labels font" - onClicked: { - if (series.pointLabelsFont.family === "Times") - series.pointLabelsFont.family = "Courier"; - else - series.pointLabelsFont.family = "Times"; - } - } - Button { - text: "point labels color" - onClicked: series.pointLabelsColor = main.nextColor(); - } - Button { - text: "append point" - onClicked: series.append(series.count - 1, series.count - 1); - } - Button { - text: "replace point" - onClicked: { - var xyPoint = series.at(series.count - 1); - series.replace(series.count - 1, xyPoint.x, xyPoint.y + 0.1); - } - } - Button { - text: "remove point" - onClicked: series.remove(series.count - 1); - } - Button { - text: "insert point" - onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2); - } - Button { - text: "clear" - onClicked: series.clear(); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml deleted file mode 100644 index e7c8793d..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "spline series" - anchors.fill: parent - property variant series: splineSeries - animationOptions: ChartView.SeriesAnimations - - SplineSeries { - id: splineSeries - name: "spline 1" - XYPoint { x: 0; y: 0 } - XYPoint { x: 1.1; y: 2.1 } - XYPoint { x: 1.9; y: 3.3 } - XYPoint { x: 2.1; y: 2.1 } - XYPoint { x: 2.9; y: 4.9 } - XYPoint { x: 3.4; y: 3.0 } - XYPoint { x: 4.1; y: 3.3 } - - pointLabelsFormat: "@xPoint, @yPoint"; - - onNameChanged: console.log("splineSeries.onNameChanged: " + name); - onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible); - onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity); - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); - onPointReplaced: console.log("splineSeries.onPointReplaced: " + index); - onPointRemoved: console.log("splineSeries.onPointRemoved: " + index); - onPointAdded: console.log("splineSeries.onPointAdded: " + series.at(index).x + ", " + series.at(index).y); - onColorChanged: console.log("splineSeries.onColorChanged: " + color); - onWidthChanged: console.log("splineSeries.onWidthChanged: " + width); - onStyleChanged: console.log("splineSeries.onStyleChanged: " + style); - onCapStyleChanged: console.log("splineSeries.onCapStyleChanged: " + capStyle); - onCountChanged: console.log("splineSeries.onCountChanged: " + count); - onPointLabelsVisibilityChanged: console.log("splineSeries.onPointLabelsVisibilityChanged: " - + visible); - onPointLabelsFormatChanged: console.log("splineSeries.onPointLabelsFormatChanged: " - + format); - onPointLabelsFontChanged: console.log("splineSeries.onPointLabelsFontChanged: " - + font.family); - onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: " - + color); - } - - SplineSeries { - name: "spline 2" - XYPoint { x: 1.1; y: 1.1 } - XYPoint { x: 1.9; y: 2.3 } - XYPoint { x: 2.1; y: 1.1 } - XYPoint { x: 2.9; y: 3.9 } - XYPoint { x: 3.4; y: 2.0 } - XYPoint { x: 4.1; y: 2.3 } - onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); - onHovered: console.log(name + ".onHovered: " + point.x + ", " + point.y); - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml deleted file mode 100644 index 0890884c..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 -import QtCommercial.Chart 1.4 - -ChartView { - title: "Stacked bar series" - anchors.fill: parent - theme: ChartView.ChartThemeLight - legend.alignment: Qt.AlignBottom - animationOptions: ChartView.SeriesAnimations - - property variant series: mySeries - - StackedBarSeries { - id: mySeries - name: "bar" - labelsFormat: "@value"; - axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } - BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] - onClicked: console.log("barset.onClicked: " + index); - onHovered: console.log("barset.onHovered: " + status + " " + index); - onPenChanged: console.log("barset.onPenChanged: " + pen); - onBrushChanged: console.log("barset.onBrushChanged: " + brush); - onLabelChanged: console.log("barset.onLabelChanged: " + label); - onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); - onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); - onColorChanged: console.log("barset.onColorChanged: " + color); - onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); - onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); - onCountChanged: console.log("barset.onCountChanged: " + count); - onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); - onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); - onValueChanged: console.log("barset.onValuesChanged: " + index); - } - BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } - BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } - - onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name); - onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible); - onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity); - onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index); - onHovered: console.log("stackedBarSeries.onHovered: " + barset - + " " + status + " " + index); - onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); - onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count); - onLabelsFormatChanged: console.log("stackedBarSeries.onLabelsFormatChanged: " - + format); - onLabelsPositionChanged: console.log("stackedBarSeries.onLabelsPositionChanged: " - + series.labelsPosition); - - function changeLabelsPosition() { - if (labelsPosition === BarSeries.LabelsCenter) - labelsPosition = BarSeries.LabelsInsideEnd; - else - labelsPosition = BarSeries.LabelsCenter; - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml b/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml deleted file mode 100644 index 2b24d01c..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Item { - id: container - width: 640 - height: 500 - Component.onCompleted: { - var co = Qt.createComponent("main.qml") - if (co.status == Component.Ready) { - var o = co.createObject(container) - } else { - console.log(co.errorString()) - console.log("QtCommercial.Chart 1.1 not available") - console.log("Please use correct QML_IMPORT_PATH export") - } - } -} diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/main.qml b/tests/quick2chartproperties/qml/quick2chartproperties/main.qml deleted file mode 100644 index 8265e1ae..00000000 --- a/tests/quick2chartproperties/qml/quick2chartproperties/main.qml +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 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 Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise 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 2.0 - -Rectangle { - id: main - width: 800 - height: 600 - property int viewCount: 9 - property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"] - property int colorIndex: 0 - property int buttonWidth: 42 - - function nextColor() { - colorIndex++; - return colors[colorIndex % colors.length]; - } - - Row { - anchors.top: parent.top - anchors.bottom: buttonRow.top - anchors.bottomMargin: 10 - anchors.left: parent.left - anchors.right: parent.right - - Loader { - id: chartLoader - width: main.width - editorLoader.width - height: parent.height - source: "Chart.qml" - onStatusChanged: { - if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item) { - if (source.toString().search("/Chart.qml") > 0) - editorLoader.item.chart = chartLoader.item.chart; - else - editorLoader.item.series = chartLoader.item.series; - } - } - } - - Loader { - id: editorLoader - width: 280 - height: parent.height - source: "ChartEditor.qml" - onStatusChanged: { - if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item) { - if (source.toString().search("/ChartEditor.qml") > 0) - editorLoader.item.chart = chartLoader.item.chart; - else - editorLoader.item.series = chartLoader.item.series; - } - } - } - } - - Row { - id: buttonRow - height: 40 - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Button { - text: "chart" - width: buttonWidth - onClicked: { - chartLoader.source = "Chart.qml"; - editorLoader.source = "ChartEditor.qml"; - } - } - Button { - text: "pie" - width: buttonWidth - onClicked: { - chartLoader.source = "PieChart.qml"; - editorLoader.source = "PieEditor.qml"; - } - } - Button { - text: "line" - width: buttonWidth - onClicked: { - chartLoader.source = "LineChart.qml"; - editorLoader.source = "LineEditor.qml"; - } - } - Button { - text: "spline" - width: buttonWidth - onClicked: { - chartLoader.source = "SplineChart.qml"; - editorLoader.source = "LineEditor.qml"; - } - } - Button { - text: "scatter" - width: buttonWidth - onClicked: { - chartLoader.source = "ScatterChart.qml"; - editorLoader.source = "ScatterEditor.qml"; - } - } - Button { - text: "area" - width: buttonWidth - onClicked: { - chartLoader.source = "AreaChart.qml"; - editorLoader.source = "AreaEditor.qml"; - } - } - Button { - text: "bar" - width: buttonWidth - onClicked: { - chartLoader.source = "BarChart.qml"; - editorLoader.source = "BarEditor.qml"; - } - } - Button { - text: "sbar" - width: buttonWidth - onClicked: { - chartLoader.source = "StackedBarChart.qml"; - editorLoader.source = "BarEditor.qml"; - } - } - Button { - text: "pbar" - width: buttonWidth - onClicked: { - chartLoader.source = "PercentBarChart.qml"; - editorLoader.source = "BarEditor.qml"; - } - } - Button { - text: "hbar" - width: buttonWidth - onClicked: { - chartLoader.source = "HorizontalBarChart.qml"; - editorLoader.source = "BarEditor.qml"; - } - } - Button { - text: "hsbar" - width: buttonWidth - onClicked: { - chartLoader.source = "HorizontalStackedBarChart.qml"; - editorLoader.source = "BarEditor.qml"; - } - } - Button { - text: "hpbar" - width: buttonWidth - onClicked: { - chartLoader.source = "HorizontalPercentBarChart.qml"; - editorLoader.source = "BarEditor.qml"; - } - } - } -} diff --git a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp deleted file mode 100644 index b58190f6..00000000 --- a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// checksum 0xc01f version 0x90005 -/* - This file was generated by the Qt Quick 2 Application wizard of Qt Creator. - QtQuick2ApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#include "qtquick2applicationviewer.h" - -#include <QtCore/QCoreApplication> -#include <QtCore/QDir> -#include <QtQml/QQmlEngine> - -class QtQuick2ApplicationViewerPrivate -{ - QString mainQmlFile; - friend class QtQuick2ApplicationViewer; - static QString adjustPath(const QString &path); -}; - -QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) -{ -#if defined(Q_OS_IOS) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_MAC) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/../Resources/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_BLACKBERRY) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("app/native/%1").arg(path); -#elif !defined(Q_OS_ANDROID) - QString pathInInstallDir = - QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; - pathInInstallDir = - QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#elif defined(Q_OS_ANDROID_NO_SDK) - return QLatin1String("/data/user/qt/") + path; -#endif - return path; -} - -QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) - : QQuickView(parent) - , d(new QtQuick2ApplicationViewerPrivate()) -{ - connect(engine(), SIGNAL(quit()), SLOT(close())); - setResizeMode(QQuickView::SizeRootObjectToView); -} - -QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() -{ - delete d; -} - -void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) -{ - d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) - setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); -#else - setSource(QUrl::fromLocalFile(d->mainQmlFile)); -#endif -} - -void QtQuick2ApplicationViewer::addImportPath(const QString &path) -{ - engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); -} - -void QtQuick2ApplicationViewer::showExpanded() -{ -#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX) - showFullScreen(); -#else - show(); -#endif -} diff --git a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h b/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h deleted file mode 100644 index cf66f140..00000000 --- a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.h +++ /dev/null @@ -1,33 +0,0 @@ -// checksum 0xfde6 version 0x90005 -/* - This file was generated by the Qt Quick 2 Application wizard of Qt Creator. - QtQuick2ApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#ifndef QTQUICK2APPLICATIONVIEWER_H -#define QTQUICK2APPLICATIONVIEWER_H - -#include <QtQuick/QQuickView> - -class QtQuick2ApplicationViewer : public QQuickView -{ - Q_OBJECT - -public: - explicit QtQuick2ApplicationViewer(QWindow *parent = 0); - virtual ~QtQuick2ApplicationViewer(); - - void setMainQmlFile(const QString &file); - void addImportPath(const QString &path); - - void showExpanded(); - -private: - class QtQuick2ApplicationViewerPrivate *d; -}; - -#endif // QTQUICK2APPLICATIONVIEWER_H diff --git a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri b/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri deleted file mode 100644 index b2d0f51d..00000000 --- a/tests/quick2chartproperties/qtquick2applicationviewer/qtquick2applicationviewer.pri +++ /dev/null @@ -1,6 +0,0 @@ -QT += qml quick widgets - -SOURCES += $$PWD/qtquick2applicationviewer.cpp -HEADERS += $$PWD/qtquick2applicationviewer.h -INCLUDEPATH += $$PWD - diff --git a/tests/quick2chartproperties/quick2chartproperties.pro b/tests/quick2chartproperties/quick2chartproperties.pro deleted file mode 100644 index e665f9c5..00000000 --- a/tests/quick2chartproperties/quick2chartproperties.pro +++ /dev/null @@ -1,9 +0,0 @@ -!include( ../tests.pri ) { - error( "Couldn't find the test.pri file!" ) -} - -RESOURCES += resources.qrc -SOURCES += main.cpp -OTHER_FILES += qml/quick2chartproperties/* - -include(qtquick2applicationviewer/qtquick2applicationviewer.pri) diff --git a/tests/quick2chartproperties/resources.qrc b/tests/quick2chartproperties/resources.qrc deleted file mode 100644 index 181ff6c0..00000000 --- a/tests/quick2chartproperties/resources.qrc +++ /dev/null @@ -1,31 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/quick2chartproperties/loader.qml</file> - <file>qml/quick2chartproperties/main.qml</file> - <file>qml/quick2chartproperties/Button.qml</file> - <file>qml/quick2chartproperties/PieChart.qml</file> - <file>qml/quick2chartproperties/PieEditor.qml</file> - <file>qml/quick2chartproperties/LineChart.qml</file> - <file>qml/quick2chartproperties/LineEditor.qml</file> - <file>qml/quick2chartproperties/SplineChart.qml</file> - <file>qml/quick2chartproperties/ScatterChart.qml</file> - <file>qml/quick2chartproperties/AreaChart.qml</file> - <file>qml/quick2chartproperties/BarChart.qml</file> - <file>qml/quick2chartproperties/BarEditor.qml</file> - <file>qml/quick2chartproperties/ScatterEditor.qml</file> - <file>qml/quick2chartproperties/AreaEditor.qml</file> - <file>qml/quick2chartproperties/StackedBarChart.qml</file> - <file>qml/quick2chartproperties/PercentBarChart.qml</file> - <file>qml/quick2chartproperties/Chart.qml</file> - <file>qml/quick2chartproperties/ChartEditor.qml</file> - <file>qml/quick2chartproperties/FontEditor.qml</file> - <file>qml/quick2chartproperties/HorizontalBarChart.qml</file> - <file>qml/quick2chartproperties/HorizontalPercentBarChart.qml</file> - <file>qml/quick2chartproperties/HorizontalStackedBarChart.qml</file> - <file>qml/quick2chartproperties/ChartEditorAxis.qml</file> - <file>qml/quick2chartproperties/ChartEditorLegend.qml</file> - <file>qml/quick2chartproperties/ChartEditorProperties.qml</file> - <file>qml/quick2chartproperties/ChartEditorTitle.qml</file> - <file>qml/quick2chartproperties/ChartEditorSeries.qml</file> - </qresource> -</RCC> diff --git a/tests/tests.pri b/tests/tests.pri index ec0cd754..1a723c59 100644 --- a/tests/tests.pri +++ b/tests/tests.pri @@ -1,36 +1,13 @@ -!include( ../config.pri ) { - error( "Couldn't find the config.pri file!" ) -} +INCLUDEPATH += ../../include +LIBS += -L$$OUT_PWD/../../lib TEMPLATE = app -DESTDIR = $$CHART_BUILD_BIN_DIR -OBJECTS_DIR = $$CHART_BUILD_DIR/tests/$$TARGET -MOC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET -UI_DIR = $$CHART_BUILD_DIR/tests/$$TARGET -RCC_DIR = $$CHART_BUILD_DIR/tests/$$TARGET - -# staticlib config causes problems when building executables -staticlib: CONFIG-=staticlib +QT += charts -android { - # Workaround to fix android deployment, which seems to always look for target in - # OUT_PWD instead of DESTDIR. - COPY_PARAMETERS = "$$CHART_BUILD_BIN_DIR/lib$${TARGET}.so $$OUT_PWD/lib$${TARGET}.so" - contains(QMAKE_HOST.os, Windows): COPY_PARAMETERS = $$replace(COPY_PARAMETERS, "/","\\") - QMAKE_POST_LINK += $$QMAKE_COPY $$COPY_PARAMETERS - - contains(TARGET, qml.*) { - charts_qmldir.files = $$CHART_BUILD_QML_PLUGIN_DIR/qmldir - charts_qmldir.path = /assets/imports/QtCommercial/Chart - charts_qmlplugin.files = $$CHART_BUILD_QML_PLUGIN_DIR/libqtcommercialchartqml.so - charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH - INSTALLS += charts_qmldir charts_qmlplugin - } else:contains(TARGET, quick2.*) { - charts_qmldir.files = $$CHART_BUILD_QML2_PLUGIN_DIR/qmldir - charts_qmldir.path = /assets/qml/QtCommercial/Chart - charts_qmlplugin.files = $$CHART_BUILD_QML2_PLUGIN_DIR/libqtcommercialchartqml2.so - charts_qmlplugin.path = /libs/$$ANDROID_TARGET_ARCH - INSTALLS += charts_qmldir charts_qmlplugin - } +contains(TARGET, qml.*) { + QT += qml quick } + +target.path = $$[QT_INSTALL_TESTS]/charts/$$TARGET +INSTALLS += target diff --git a/tests/tests.pro b/tests/tests.pro index 79686122..e6aa3561 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,7 +1,3 @@ -!include( ../config.pri ) { - error( "Couldn't find the config.pri file!" ) -} - TEMPLATE = subdirs SUBDIRS += \ auto \ @@ -9,11 +5,6 @@ SUBDIRS += \ polarcharttest \ boxplottester -!contains(QT_VERSION, ^5\\..*\\..*$)|qtHaveModule(declarative) { - SUBDIRS += qmlchartproperties \ - qmlchartaxis -} - contains(QT_CONFIG, opengl) { SUBDIRS += chartwidgettest \ wavechart \ @@ -22,6 +13,7 @@ contains(QT_CONFIG, opengl) { message("OpenGL not available. Some test apps are disabled") } -contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) { - SUBDIRS += quick2chartproperties +qtHaveModule(quick) { + SUBDIRS += qmlchartproperties \ + qmlchartaxis } diff --git a/tests/wavechart/wavechart.cpp b/tests/wavechart/wavechart.cpp index 82eaf125..dc05d073 100644 --- a/tests/wavechart/wavechart.cpp +++ b/tests/wavechart/wavechart.cpp @@ -21,7 +21,7 @@ #include "wavechart.h" #include <cmath> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE #define PI 3.14159265358979 static const int numPoints =100; diff --git a/tests/wavechart/wavechart.h b/tests/wavechart/wavechart.h index 0bb3a904..336fa151 100644 --- a/tests/wavechart/wavechart.h +++ b/tests/wavechart/wavechart.h @@ -27,7 +27,7 @@ #include <QLineSeries> #include <QChartView> -QTCOMMERCIALCHART_USE_NAMESPACE +QT_CHARTS_USE_NAMESPACE class WaveChart: public QChartView { |