summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README24
-rw-r--r--config.pri8
-rw-r--r--demos/demos.pro5
-rw-r--r--demos/qmlaxes/qmlaxes.pro3
-rw-r--r--demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlchart/qmlchart.pro2
-rw-r--r--demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlcustomizations/qmlcustomizations.pro2
-rw-r--r--demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h46
-rwxr-xr-xdemos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri13
-rwxr-xr-xdemos/qmlcustomlegend/qmlcustomlegend.pro2
-rw-r--r--demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlcustommodel/qmlcustommodel.pro2
-rw-r--r--demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri169
-rw-r--r--demos/qmlf1legends/qmlf1legends.pro2
-rw-r--r--demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmloscilloscope/qmloscilloscope.pro2
-rw-r--r--demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--demos/qmlpolarchart/qmlpolarchart.pro2
-rw-r--r--demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri169
-rw-r--r--demos/qmlweather/qmlweather.pro2
-rw-r--r--demos/quick2chart/main.cpp34
-rw-r--r--demos/quick2chart/qml/quick2chart/View1.qml54
-rw-r--r--demos/quick2chart/qml/quick2chart/View10.qml42
-rw-r--r--demos/quick2chart/qml/quick2chart/View11.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/View12.qml77
-rw-r--r--demos/quick2chart/qml/quick2chart/View2.qml45
-rw-r--r--demos/quick2chart/qml/quick2chart/View3.qml45
-rw-r--r--demos/quick2chart/qml/quick2chart/View4.qml109
-rw-r--r--demos/quick2chart/qml/quick2chart/View5.qml57
-rw-r--r--demos/quick2chart/qml/quick2chart/View6.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/View7.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/View8.qml42
-rw-r--r--demos/quick2chart/qml/quick2chart/View9.qml43
-rw-r--r--demos/quick2chart/qml/quick2chart/loader.qml37
-rw-r--r--demos/quick2chart/qml/quick2chart/main.qml91
-rw-r--r--demos/quick2chart/quick2chart.pro10
-rw-r--r--demos/quick2chart/resources.qrc18
-rw-r--r--demos/quick2oscilloscope/datasource.cpp90
-rw-r--r--demos/quick2oscilloscope/datasource.h49
-rw-r--r--demos/quick2oscilloscope/main.cpp40
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml86
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml54
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml116
-rw-r--r--demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml64
-rw-r--r--demos/quick2oscilloscope/quick2oscilloscope.pro14
-rw-r--r--demos/quick2oscilloscope/resources.qrc8
-rw-r--r--demos/shared/qmlapplicationviewer/qmlapplicationviewer.cpp (renamed from demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp)1
-rw-r--r--demos/shared/qmlapplicationviewer/qmlapplicationviewer.h (renamed from demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h)0
-rw-r--r--demos/shared/qmlapplicationviewer/qmlapplicationviewer.pri (renamed from demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri)0
-rw-r--r--demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.cpp71
-rw-r--r--demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.h33
-rw-r--r--demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.pri6
-rw-r--r--doc/src/demos-quick2chart.qdoc13
-rw-r--r--doc/src/demos-quick2oscilloscope.qdoc16
-rw-r--r--doc/src/demos.qdoc8
-rw-r--r--doc/src/qml.qdoc6
-rw-r--r--examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--examples/qmlpiechart/qmlpiechart.pro2
-rw-r--r--plugins/declarative/declarative.pri58
-rw-r--r--plugins/declarative/declarative.pro54
-rw-r--r--plugins/declarative/declarativebarseries.cpp48
-rw-r--r--plugins/declarative/declarativebarseries.h103
-rw-r--r--plugins/declarative/declarativecategoryaxis.cpp6
-rw-r--r--plugins/declarative/declarativecategoryaxis.h18
-rw-r--r--plugins/declarative/declarativechart.cpp63
-rw-r--r--plugins/declarative/declarativechart.h38
-rw-r--r--plugins/declarative/declarativelineseries.cpp6
-rw-r--r--plugins/declarative/declarativelineseries.h21
-rw-r--r--plugins/declarative/declarativepieseries.cpp8
-rw-r--r--plugins/declarative/declarativepieseries.h20
-rw-r--r--plugins/declarative/declarativepolarchart.cpp2
-rw-r--r--plugins/declarative/declarativepolarchart.h9
-rw-r--r--plugins/declarative/declarativescatterseries.cpp6
-rw-r--r--plugins/declarative/declarativescatterseries.h21
-rw-r--r--plugins/declarative/declarativesplineseries.cpp6
-rw-r--r--plugins/declarative/declarativesplineseries.h21
-rw-r--r--plugins/declarative/plugin.cpp14
-rw-r--r--plugins/declarative/shared_defines.h42
-rw-r--r--plugins/plugins.pro5
-rw-r--r--plugins/quick1/qmldir (renamed from plugins/declarative/qmldir)0
-rw-r--r--plugins/quick1/quick1.pro8
-rw-r--r--plugins/quick2/qmldir2
-rw-r--r--plugins/quick2/quick2.pro9
-rw-r--r--tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--tests/qmlchartaxis/qmlchartaxis.pro2
-rw-r--r--tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp177
-rw-r--r--tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h46
-rw-r--r--tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.pri13
-rw-r--r--tests/qmlchartproperties/qmlchartproperties.pro2
-rw-r--r--tests/quick2chartproperties/main.cpp34
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml101
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml85
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml65
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml186
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/Button.qml70
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml106
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml119
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml131
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml76
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml116
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml64
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml35
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml92
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml64
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml64
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml64
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml67
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml97
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml65
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml67
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml228
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml63
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml92
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml65
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml64
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/loader.qml37
-rw-r--r--tests/quick2chartproperties/qml/quick2chartproperties/main.qml179
-rw-r--r--tests/quick2chartproperties/quick2chartproperties.pro9
-rw-r--r--tests/quick2chartproperties/resources.qrc31
-rw-r--r--tests/tests.pro4
140 files changed, 4506 insertions, 3100 deletions
diff --git a/README b/README
index 9c49c093..ffa73f67 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
--------------------------------
-Commercial Charts Add-on 1.2.1
+Commercial Charts Add-on 1.3.0
--------------------------------
What's in Qt Commercial Charts
@@ -64,29 +64,15 @@ Documentation can be found from doc/html and doc/qch directories. The documentat
can also be generated with:
make docs
-Main Changes between 1.2.0 and 1.2.1
+Main Changes between 1.2.1 and 1.3.0
===================================
-- Commercial Charts documentation also as *.qch file
+- New chart type added: Polar chart
+- QtQuick 2 support added
Bug Fixes
==========
-- Fixed: Crash with NaN, inf, -inf values (values are ignored)
-- Fixed: Axis label truncated with multiple axis
-- Fixed: Using setLineVisible(false) on a QBarCategoryAxis gives blurry text
-- Fixed: Set the range to min and max for default axes from previously added series
-- Fixed: Axes use incorrect bounding rectangle to calculate sizeHint when labels are in non-default angle
-- Fixed: Axis titles can slightly overlap with axis labels and axis lines
-- Fixed: Charts crashes when changing the values to empty model with logarithmic axis
-- Fixed: The legend marker for main series in breakdown series piechart couldnt be updated with custom value
-- Fixed: Positioning errors with category axis and bar category axis ticks
-- Fixed: Setting points visible for upper or lower line series of an area series causes the area series to fill incorrectly
-- Fixed: Changing from "High Contrast" theme to another theme draws some grid lines thicker than it is supposed to
-- Fixed: QCategoryAxis shading is drawn even if the shaded category is scrolled off-chart
-- Fixed: QBarCategoryAxis with odd number of categories and shading draws an additional shade on top of the chart
-- Fixed: Setting points visible for a line chart sometimes doesn't draw the points but instead draws a filled area
-- Fixed: Exploding a piechart slice with a thick pen causes rendering artifacts during the explosion animation
-- Fixed: Pen style pattern continuity for line series
+TODO
Known Issues
============
diff --git a/config.pri b/config.pri
index b0018026..eddcb4cd 100644
--- a/config.pri
+++ b/config.pri
@@ -40,13 +40,15 @@ CHART_BUILD_LIB_DIR = $$SHADOW/lib
CHART_BUILD_DIR = $$SHADOW/build
CHART_BUILD_BIN_DIR = $$SHADOW/bin
CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_BIN_DIR
+CHART_BUILD_QML2_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR
CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR
CHART_BUILD_DOC_DIR = $$SHADOW/doc
CONFIG(release,debug|release){
CHART_BUILD_LIB_DIR = $$CHART_BUILD_LIB_DIR/release
CHART_BUILD_BIN_DIR = $$CHART_BUILD_BIN_DIR/release
- CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/release/QtCommercial/Chart
+ CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/release/imports/QtCommercial/Chart
+ CHART_BUILD_QML2_PLUGIN_DIR = $$CHART_BUILD_QML2_PLUGIN_DIR/release/qml/QtCommercial/Chart
CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR
}
@@ -54,7 +56,8 @@ CONFIG(release,debug|release){
CONFIG(debug,debug|release){
CHART_BUILD_LIB_DIR = $$CHART_BUILD_LIB_DIR/debug
CHART_BUILD_BIN_DIR = $$CHART_BUILD_BIN_DIR/debug
- CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/debug/QtCommercial/Chart
+ CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/debug/imports/QtCommercial/Chart
+ CHART_BUILD_QML2_PLUGIN_DIR = $$CHART_BUILD_QML2_PLUGIN_DIR/debug/qml/QtCommercial/Chart
CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR
}
# Use own folders for debug and release builds
@@ -69,6 +72,7 @@ contains(QMAKE_HOST.os, Windows) {
CHART_BUILD_BUILD_DIR = $$replace(CHART_BUILD_BUILD_DIR, "/","\\")
CHART_BUILD_BIN_DIR = $$replace(CHART_BUILD_BIN_DIR, "/","\\")
CHART_BUILD_QML_PLUGIN_DIR = $$replace(CHART_BUILD_QML_PLUGIN_DIR, "/","\\")
+ CHART_BUILD_QML2_PLUGIN_DIR = $$replace(CHART_BUILD_QML2_PLUGIN_DIR, "/","\\")
CHART_BUILD_DESIGNER_PLUGIN_DIR = $$replace(CHART_BUILD_DESIGNER_PLUGIN_DIR, "/","\\")
CHART_BUILD_DOC_DIR = $$replace(CHART_BUILD_DOC_DIR, "/","\\")
CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\")
diff --git a/demos/demos.pro b/demos/demos.pro
index 76a53c50..c66eafcd 100644
--- a/demos/demos.pro
+++ b/demos/demos.pro
@@ -30,3 +30,8 @@ contains(QT_CONFIG, multimedia) {
} else {
message("QtMultimedia library not available. Some demos are disabled")
}
+
+contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) {
+ SUBDIRS += quick2chart \
+ quick2oscilloscope
+}
diff --git a/demos/qmlaxes/qmlaxes.pro b/demos/qmlaxes/qmlaxes.pro
index 82294279..8b776d82 100644
--- a/demos/qmlaxes/qmlaxes.pro
+++ b/demos/qmlaxes/qmlaxes.pro
@@ -4,5 +4,6 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
+OTHER_FILES += qml/qmlaxes/*
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlchart/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlchart/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/demos/qmlchart/qmlchart.pro b/demos/qmlchart/qmlchart.pro
index 82294279..b9a6322e 100644
--- a/demos/qmlchart/qmlchart.pro
+++ b/demos/qmlchart/qmlchart.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlcustomizations/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlcustomizations/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/demos/qmlcustomizations/qmlcustomizations.pro b/demos/qmlcustomizations/qmlcustomizations.pro
index 82294279..b9a6322e 100644
--- a/demos/qmlcustomizations/qmlcustomizations.pro
+++ b/demos/qmlcustomizations/qmlcustomizations.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlcustomlegend/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100755
index 84500198..00000000
--- a/demos/qmlcustomlegend/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/demos/qmlcustomlegend/qmlcustomlegend.pro b/demos/qmlcustomlegend/qmlcustomlegend.pro
index c8df3e0b..bab0f20a 100755
--- a/demos/qmlcustomlegend/qmlcustomlegend.pro
+++ b/demos/qmlcustomlegend/qmlcustomlegend.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlcustommodel/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/demos/qmlcustommodel/qmlcustommodel.pro b/demos/qmlcustommodel/qmlcustommodel.pro
index a8023ec4..28b59c73 100644
--- a/demos/qmlcustommodel/qmlcustommodel.pro
+++ b/demos/qmlcustommodel/qmlcustommodel.pro
@@ -9,4 +9,4 @@ SOURCES += main.cpp\
HEADERS += customtablemodel.h \
declarativemodel.h
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 1134cbcd..00000000
--- a/demos/qmlf1legends/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,169 +0,0 @@
-# checksum 0x77b version 0x80016
-# This file was generated by the Qt Quick Application wizard of Qt Creator.
-# The code below adds the QmlApplicationViewer to the project and handles the
-# activation of QML debugging.
-# It is recommended not to modify this file, since newer versions of Qt Creator
-# may offer an updated version of it.
-
-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
-}
-
-contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) {
- DEFINES += HARMATTAN_BOOSTER
-}
-# This file was generated by an application wizard of Qt Creator.
-# The code below handles deployment to Android and Maemo, aswell as copying
-# of the application data to shadow build directories on desktop.
-# It is recommended not to modify this file, since newer versions of Qt Creator
-# may offer an updated version of it.
-
-defineTest(qtcAddDeployment) {
-for(deploymentfolder, DEPLOYMENTFOLDERS) {
- item = item$${deploymentfolder}
- greaterThan(QT_MAJOR_VERSION, 4) {
- itemsources = $${item}.files
- } else {
- itemsources = $${item}.sources
- }
- $$itemsources = $$eval($${deploymentfolder}.source)
- itempath = $${item}.path
- $$itempath= $$eval($${deploymentfolder}.target)
- export($$itemsources)
- export($$itempath)
- DEPLOYMENT += $$item
-}
-
-MAINPROFILEPWD = $$PWD
-
-android {
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- item = item$${deploymentfolder}
- itemfiles = $${item}.files
- $$itemfiles = $$eval($${deploymentfolder}.source)
- itempath = $${item}.path
- $$itempath = /assets/$$eval($${deploymentfolder}.target)
- export($$itemfiles)
- export($$itempath)
- INSTALLS += $$item
- }
-
- x86 {
- target.path = /libs/x86
- } else: armeabi-v7a {
- target.path = /libs/armeabi-v7a
- } else {
- target.path = /libs/armeabi
- }
-
- export(target.path)
- INSTALLS += target
-} else:win32 {
- copyCommand =
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
- source = $$replace(source, /, \\)
- sourcePathSegments = $$split(source, \\)
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
- target = $$replace(target, /, \\)
- target ~= s,\\\\\\.?\\\\,\\,
- !isEqual(source,$$target) {
- !isEmpty(copyCommand):copyCommand += &&
- isEqual(QMAKE_DIR_SEP, \\) {
- copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
- } else {
- source = $$replace(source, \\\\, /)
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
- target = $$replace(target, \\\\, /)
- copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
- }
- }
- }
- !isEmpty(copyCommand) {
- copyCommand = @echo Copying application data... && $$copyCommand
- copydeploymentfolders.commands = $$copyCommand
- first.depends = $(first) copydeploymentfolders
- export(first.depends)
- export(copydeploymentfolders.commands)
- QMAKE_EXTRA_TARGETS += first copydeploymentfolders
- }
-} else:unix {
- maemo5 {
- desktopfile.files = $${TARGET}.desktop
- desktopfile.path = /usr/share/applications/hildon
- icon.files = $${TARGET}64.png
- icon.path = /usr/share/icons/hicolor/64x64/apps
- } else:!isEmpty(MEEGO_VERSION_MAJOR) {
- desktopfile.files = $${TARGET}_harmattan.desktop
- desktopfile.path = /usr/share/applications
- icon.files = $${TARGET}80.png
- icon.path = /usr/share/icons/hicolor/80x80/apps
- } else { # Assumed to be a Desktop Unix
- copyCommand =
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
- source = $$replace(source, \\\\, /)
- macx {
- target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
- } else {
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
- }
- target = $$replace(target, \\\\, /)
- sourcePathSegments = $$split(source, /)
- targetFullPath = $$target/$$last(sourcePathSegments)
- targetFullPath ~= s,/\\.?/,/,
- !isEqual(source,$$targetFullPath) {
- !isEmpty(copyCommand):copyCommand += &&
- copyCommand += $(MKDIR) \"$$target\"
- copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
- }
- }
- !isEmpty(copyCommand) {
- copyCommand = @echo Copying application data... && $$copyCommand
- copydeploymentfolders.commands = $$copyCommand
- first.depends = $(first) copydeploymentfolders
- export(first.depends)
- export(copydeploymentfolders.commands)
- QMAKE_EXTRA_TARGETS += first copydeploymentfolders
- }
- }
- installPrefix = /opt/$${TARGET}
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- item = item$${deploymentfolder}
- itemfiles = $${item}.files
- $$itemfiles = $$eval($${deploymentfolder}.source)
- itempath = $${item}.path
- $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
- export($$itemfiles)
- export($$itempath)
- INSTALLS += $$item
- }
-
- !isEmpty(desktopfile.path) {
- export(icon.files)
- export(icon.path)
- export(desktopfile.files)
- export(desktopfile.path)
- INSTALLS += icon desktopfile
- }
-
- target.path = $${installPrefix}/bin
- export(target.path)
- INSTALLS += target
-}
-
-export (ICON)
-export (INSTALLS)
-export (DEPLOYMENT)
-export (LIBS)
-export (QMAKE_EXTRA_TARGETS)
-}
diff --git a/demos/qmlf1legends/qmlf1legends.pro b/demos/qmlf1legends/qmlf1legends.pro
index 82294279..b9a6322e 100644
--- a/demos/qmlf1legends/qmlf1legends.pro
+++ b/demos/qmlf1legends/qmlf1legends.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmloscilloscope/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmloscilloscope/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/demos/qmloscilloscope/qmloscilloscope.pro b/demos/qmloscilloscope/qmloscilloscope.pro
index bab2aecb..05e2350e 100644
--- a/demos/qmloscilloscope/qmloscilloscope.pro
+++ b/demos/qmloscilloscope/qmloscilloscope.pro
@@ -7,7 +7,7 @@ RESOURCES += resources.qrc
SOURCES += main.cpp \
datasource.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
HEADERS += \
datasource.h
diff --git a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlpolarchart/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/demos/qmlpolarchart/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/demos/qmlpolarchart/qmlpolarchart.pro b/demos/qmlpolarchart/qmlpolarchart.pro
index f661312b..2730caae 100644
--- a/demos/qmlpolarchart/qmlpolarchart.pro
+++ b/demos/qmlpolarchart/qmlpolarchart.pro
@@ -6,4 +6,4 @@ RESOURCES += resources.qrc
SOURCES += main.cpp
OTHER_FILES += qml/qmlpolarchart/*
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 1134cbcd..00000000
--- a/demos/qmlweather/qmlapplicationviewer/qmlapplicationviewer.pri
+++ /dev/null
@@ -1,169 +0,0 @@
-# checksum 0x77b version 0x80016
-# This file was generated by the Qt Quick Application wizard of Qt Creator.
-# The code below adds the QmlApplicationViewer to the project and handles the
-# activation of QML debugging.
-# It is recommended not to modify this file, since newer versions of Qt Creator
-# may offer an updated version of it.
-
-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
-}
-
-contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) {
- DEFINES += HARMATTAN_BOOSTER
-}
-# This file was generated by an application wizard of Qt Creator.
-# The code below handles deployment to Android and Maemo, aswell as copying
-# of the application data to shadow build directories on desktop.
-# It is recommended not to modify this file, since newer versions of Qt Creator
-# may offer an updated version of it.
-
-defineTest(qtcAddDeployment) {
-for(deploymentfolder, DEPLOYMENTFOLDERS) {
- item = item$${deploymentfolder}
- greaterThan(QT_MAJOR_VERSION, 4) {
- itemsources = $${item}.files
- } else {
- itemsources = $${item}.sources
- }
- $$itemsources = $$eval($${deploymentfolder}.source)
- itempath = $${item}.path
- $$itempath= $$eval($${deploymentfolder}.target)
- export($$itemsources)
- export($$itempath)
- DEPLOYMENT += $$item
-}
-
-MAINPROFILEPWD = $$PWD
-
-android {
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- item = item$${deploymentfolder}
- itemfiles = $${item}.files
- $$itemfiles = $$eval($${deploymentfolder}.source)
- itempath = $${item}.path
- $$itempath = /assets/$$eval($${deploymentfolder}.target)
- export($$itemfiles)
- export($$itempath)
- INSTALLS += $$item
- }
-
- x86 {
- target.path = /libs/x86
- } else: armeabi-v7a {
- target.path = /libs/armeabi-v7a
- } else {
- target.path = /libs/armeabi
- }
-
- export(target.path)
- INSTALLS += target
-} else:win32 {
- copyCommand =
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
- source = $$replace(source, /, \\)
- sourcePathSegments = $$split(source, \\)
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
- target = $$replace(target, /, \\)
- target ~= s,\\\\\\.?\\\\,\\,
- !isEqual(source,$$target) {
- !isEmpty(copyCommand):copyCommand += &&
- isEqual(QMAKE_DIR_SEP, \\) {
- copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
- } else {
- source = $$replace(source, \\\\, /)
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
- target = $$replace(target, \\\\, /)
- copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
- }
- }
- }
- !isEmpty(copyCommand) {
- copyCommand = @echo Copying application data... && $$copyCommand
- copydeploymentfolders.commands = $$copyCommand
- first.depends = $(first) copydeploymentfolders
- export(first.depends)
- export(copydeploymentfolders.commands)
- QMAKE_EXTRA_TARGETS += first copydeploymentfolders
- }
-} else:unix {
- maemo5 {
- desktopfile.files = $${TARGET}.desktop
- desktopfile.path = /usr/share/applications/hildon
- icon.files = $${TARGET}64.png
- icon.path = /usr/share/icons/hicolor/64x64/apps
- } else:!isEmpty(MEEGO_VERSION_MAJOR) {
- desktopfile.files = $${TARGET}_harmattan.desktop
- desktopfile.path = /usr/share/applications
- icon.files = $${TARGET}80.png
- icon.path = /usr/share/icons/hicolor/80x80/apps
- } else { # Assumed to be a Desktop Unix
- copyCommand =
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
- source = $$replace(source, \\\\, /)
- macx {
- target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
- } else {
- target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
- }
- target = $$replace(target, \\\\, /)
- sourcePathSegments = $$split(source, /)
- targetFullPath = $$target/$$last(sourcePathSegments)
- targetFullPath ~= s,/\\.?/,/,
- !isEqual(source,$$targetFullPath) {
- !isEmpty(copyCommand):copyCommand += &&
- copyCommand += $(MKDIR) \"$$target\"
- copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
- }
- }
- !isEmpty(copyCommand) {
- copyCommand = @echo Copying application data... && $$copyCommand
- copydeploymentfolders.commands = $$copyCommand
- first.depends = $(first) copydeploymentfolders
- export(first.depends)
- export(copydeploymentfolders.commands)
- QMAKE_EXTRA_TARGETS += first copydeploymentfolders
- }
- }
- installPrefix = /opt/$${TARGET}
- for(deploymentfolder, DEPLOYMENTFOLDERS) {
- item = item$${deploymentfolder}
- itemfiles = $${item}.files
- $$itemfiles = $$eval($${deploymentfolder}.source)
- itempath = $${item}.path
- $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
- export($$itemfiles)
- export($$itempath)
- INSTALLS += $$item
- }
-
- !isEmpty(desktopfile.path) {
- export(icon.files)
- export(icon.path)
- export(desktopfile.files)
- export(desktopfile.path)
- INSTALLS += icon desktopfile
- }
-
- target.path = $${installPrefix}/bin
- export(target.path)
- INSTALLS += target
-}
-
-export (ICON)
-export (INSTALLS)
-export (DEPLOYMENT)
-export (LIBS)
-export (QMAKE_EXTRA_TARGETS)
-}
diff --git a/demos/qmlweather/qmlweather.pro b/demos/qmlweather/qmlweather.pro
index 82294279..074acb11 100644
--- a/demos/qmlweather/qmlweather.pro
+++ b/demos/qmlweather/qmlweather.pro
@@ -6,3 +6,5 @@ RESOURCES += resources.qrc
SOURCES += main.cpp
include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../shared/qmlapplicationviewer/qmlapplicationviewer.pri)
+
diff --git a/demos/quick2chart/main.cpp b/demos/quick2chart/main.cpp
new file mode 100644
index 00000000..e02f45ea
--- /dev/null
+++ b/demos/quick2chart/main.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickItem>
+#include "qtquick2applicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+ viewer.setSource(QUrl("qrc:/qml/quick2chart/main.qml"));
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/demos/quick2chart/qml/quick2chart/View1.qml b/demos/quick2chart/qml/quick2chart/View1.qml
new file mode 100644
index 00000000..30abf1ca
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View1.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![2]
+import QtQuick 2.0
+//![2]
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+ property variant othersSlice: 0
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Top-5 car brand shares in Finland"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ PieSeries {
+ id: pieSeries
+ PieSlice { label: "Volkswagen"; value: 13.5 }
+ PieSlice { label: "Toyota"; value: 10.9 }
+ PieSlice { label: "Ford"; value: 8.6 }
+ PieSlice { label: "Skoda"; value: 8.2 }
+ PieSlice { label: "Volvo"; value: 6.8 }
+ }
+ }
+
+ Component.onCompleted: {
+ // You can also manipulate slices dynamically
+ othersSlice = pieSeries.append("Others", 52.0);
+ pieSeries.find("Volkswagen").exploded = true;
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View10.qml b/demos/quick2chart/qml/quick2chart/View10.qml
new file mode 100644
index 00000000..ffe50cab
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View10.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Horizontal Stacked Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ HorizontalStackedBarSeries {
+ axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View11.qml b/demos/quick2chart/qml/quick2chart/View11.qml
new file mode 100644
index 00000000..1fc49d00
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View11.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Horizontal Percent Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ HorizontalPercentBarSeries {
+ axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
+
diff --git a/demos/quick2chart/qml/quick2chart/View12.qml b/demos/quick2chart/qml/quick2chart/View12.qml
new file mode 100644
index 00000000..936910e6
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View12.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ id: chart
+ title: "Production costs"
+ anchors.fill: parent
+ legend.visible: false
+ antialiasing: true
+
+ PieSeries {
+ id: pieOuter
+ size: 0.96
+ holeSize: 0.7
+ PieSlice { id: slice; label: "Alpha"; value: 19511; color: "#8AB846"; borderColor: "#163430" }
+ PieSlice { label: "Epsilon"; value: 11105; color: "#C0EEFF"; borderColor: "#3B391C" }
+ PieSlice { label: "Psi"; value: 9352; color: "#DF8939"; borderColor: "#13060C" }
+ }
+
+ PieSeries {
+ size: 0.7
+ id: pieInner
+ holeSize: 0.25
+
+ PieSlice { label: "Materials"; value: 10334; color: "#8AB846"; borderColor: "#163430" }
+ PieSlice { label: "Employee"; value: 3066; color: "#AAE356"; borderColor: "#163430" }
+ PieSlice { label: "Logistics"; value: 6111; color: "#99CC4E"; borderColor: "#163430" }
+
+ PieSlice { label: "Materials"; value: 7371; color: "#C0EEFF"; borderColor: "#3B391C" }
+ PieSlice { label: "Employee"; value: 2443; color: "#C9FAFF"; borderColor: "#3B391C" }
+ PieSlice { label: "Logistics"; value: 1291; color: "#B0FAFF"; borderColor: "#3B391C" }
+
+ PieSlice { label: "Materials"; value: 4022; color: "#DF8939"; borderColor: "#13060C" }
+ PieSlice { label: "Employee"; value: 3998; color: "#FC9D42"; borderColor: "#13060C" }
+ PieSlice { label: "Logistics"; value: 1332; color: "#F2963F"; borderColor: "#13060C" }
+ }
+ }
+
+ Component.onCompleted: {
+ // Set the common slice properties dynamically for convenience
+ for (var i = 0; i < pieOuter.count; i++) {
+ pieOuter.at(i).labelPosition = PieSlice.LabelOutside;
+ pieOuter.at(i).labelVisible = true;
+ pieOuter.at(i).borderWidth = 3;
+ }
+ for (var i = 0; i < pieInner.count; i++) {
+ pieInner.at(i).labelPosition = PieSlice.LabelInsideNormal;
+ pieInner.at(i).labelVisible = true;
+ pieInner.at(i).borderWidth = 2;
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View2.qml b/demos/quick2chart/qml/quick2chart/View2.qml
new file mode 100644
index 00000000..2af7da88
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View2.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Line"
+ anchors.fill: parent
+ antialiasing: true
+
+ LineSeries {
+ name: "LineSeries"
+ 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 }
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View3.qml b/demos/quick2chart/qml/quick2chart/View3.qml
new file mode 100644
index 00000000..7fe83db8
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View3.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Spline"
+ anchors.fill: parent
+ antialiasing: true
+
+ SplineSeries {
+ name: "SplineSeries"
+ XYPoint { x: 0; y: 0.0 }
+ XYPoint { x: 1.1; y: 3.2 }
+ XYPoint { x: 1.9; y: 2.4 }
+ XYPoint { x: 2.1; y: 2.1 }
+ XYPoint { x: 2.9; y: 2.6 }
+ XYPoint { x: 3.4; y: 2.3 }
+ XYPoint { x: 4.1; y: 3.1 }
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View4.qml b/demos/quick2chart/qml/quick2chart/View4.qml
new file mode 100644
index 00000000..ce2a20ef
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View4.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "NHL All-Star Team Players"
+ anchors.fill: parent
+ antialiasing: true
+
+ ValueAxis {
+ id: valueAxis
+ min: 2000
+ max: 2011
+ tickCount: 12
+ labelFormat: "%.0f"
+ }
+
+ AreaSeries {
+ name: "Russian"
+ color: "#FFD52B1E"
+ borderColor: "#FF0039A5"
+ borderWidth: 3
+ axisX: valueAxis
+ upperSeries: LineSeries {
+ XYPoint { x: 2000; y: 1 }
+ XYPoint { x: 2001; y: 1 }
+ XYPoint { x: 2002; y: 1 }
+ XYPoint { x: 2003; y: 1 }
+ XYPoint { x: 2004; y: 1 }
+ XYPoint { x: 2005; y: 0 }
+ XYPoint { x: 2006; y: 1 }
+ XYPoint { x: 2007; y: 1 }
+ XYPoint { x: 2008; y: 4 }
+ XYPoint { x: 2009; y: 3 }
+ XYPoint { x: 2010; y: 2 }
+ XYPoint { x: 2011; y: 1 }
+ }
+ }
+ // ...
+ //![1]
+
+ AreaSeries {
+ name: "Swedish"
+ color: "#AF005292"
+ borderColor: "#AFFDCA00"
+ borderWidth: 3
+ axisX: valueAxis
+ upperSeries: LineSeries {
+ XYPoint { x: 2000; y: 1 }
+ XYPoint { x: 2001; y: 1 }
+ XYPoint { x: 2002; y: 3 }
+ XYPoint { x: 2003; y: 3 }
+ XYPoint { x: 2004; y: 2 }
+ XYPoint { x: 2005; y: 0 }
+ XYPoint { x: 2006; y: 2 }
+ XYPoint { x: 2007; y: 1 }
+ XYPoint { x: 2008; y: 2 }
+ XYPoint { x: 2009; y: 1 }
+ XYPoint { x: 2010; y: 3 }
+ XYPoint { x: 2011; y: 3 }
+ }
+ }
+
+ AreaSeries {
+ name: "Finnish"
+ color: "#00357F"
+ borderColor: "#FEFEFE"
+ borderWidth: 3
+ axisX: valueAxis
+ upperSeries: LineSeries {
+ XYPoint { x: 2000; y: 0 }
+ XYPoint { x: 2001; y: 0 }
+ XYPoint { x: 2002; y: 0 }
+ XYPoint { x: 2003; y: 0 }
+ XYPoint { x: 2004; y: 0 }
+ XYPoint { x: 2005; y: 0 }
+ XYPoint { x: 2006; y: 1 }
+ XYPoint { x: 2007; y: 0 }
+ XYPoint { x: 2008; y: 0 }
+ XYPoint { x: 2009; y: 0 }
+ XYPoint { x: 2010; y: 0 }
+ XYPoint { x: 2011; y: 1 }
+ }
+ }
+ }
+}
diff --git a/demos/quick2chart/qml/quick2chart/View5.qml b/demos/quick2chart/qml/quick2chart/View5.qml
new file mode 100644
index 00000000..185c2c2a
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View5.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Scatters"
+ anchors.fill: parent
+ antialiasing: true
+
+ ScatterSeries {
+ id: scatter1
+ name: "Scatter1"
+ 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 }
+ }
+
+ ScatterSeries {
+ name: "Scatter2"
+ // ...
+ //![1]
+ 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 }
+ }
+ }
+}
diff --git a/demos/quick2chart/qml/quick2chart/View6.qml b/demos/quick2chart/qml/quick2chart/View6.qml
new file mode 100644
index 00000000..bed43ec5
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View6.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ BarSeries {
+ id: mySeries
+ axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View7.qml b/demos/quick2chart/qml/quick2chart/View7.qml
new file mode 100644
index 00000000..645fca71
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View7.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Stacked Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ StackedBarSeries {
+ id: mySeries
+ axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View8.qml b/demos/quick2chart/qml/quick2chart/View8.qml
new file mode 100644
index 00000000..df80491f
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View8.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Percent Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ PercentBarSeries {
+ axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
diff --git a/demos/quick2chart/qml/quick2chart/View9.qml b/demos/quick2chart/qml/quick2chart/View9.qml
new file mode 100644
index 00000000..dfa8db25
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/View9.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+Rectangle {
+ anchors.fill: parent
+
+ //![1]
+ ChartView {
+ title: "Horizontal Bar series"
+ anchors.fill: parent
+ legend.alignment: Qt.AlignBottom
+ antialiasing: true
+
+ HorizontalBarSeries {
+ axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] }
+ BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
+ BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
+ BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
+ }
+ }
+ //![1]
+}
+
diff --git a/demos/quick2chart/qml/quick2chart/loader.qml b/demos/quick2chart/qml/quick2chart/loader.qml
new file mode 100644
index 00000000..bebddfde
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/loader.qml
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+ width: 400
+ height: 300
+ 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/demos/quick2chart/qml/quick2chart/main.qml b/demos/quick2chart/qml/quick2chart/main.qml
new file mode 100644
index 00000000..a945b0fd
--- /dev/null
+++ b/demos/quick2chart/qml/quick2chart/main.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![1]
+import QtQuick 2.0
+//![1]
+
+Rectangle {
+ width: 360
+ height: 360
+ property int viewNumber: 1
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ source: "View" + viewNumber + ".qml";
+ }
+
+ Rectangle {
+ id: infoText
+ anchors.centerIn: parent
+ width: parent.width
+ height: 40
+ color: "black"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: "Use left and right arrow keys to navigate between chart types"
+ }
+
+ Behavior on opacity {
+ NumberAnimation { duration: 400 }
+ }
+ }
+
+ MouseArea {
+ focus: true
+ anchors.fill: parent
+ onClicked: {
+ if (infoText.opacity > 0) {
+ infoText.opacity = 0.0;
+ } else {
+ nextView();
+ }
+ }
+ Keys.onPressed: {
+ if (infoText.opacity > 0) {
+ infoText.opacity = 0.0;
+ } else {
+ if (event.key == Qt.Key_Left) {
+ previousView();
+ } else {
+ nextView();
+ }
+ }
+ }
+ }
+
+ function nextView() {
+ var i = viewNumber + 1;
+ if (i > 12)
+ viewNumber = 1;
+ else
+ viewNumber = i;
+ }
+
+ function previousView() {
+ var i = viewNumber - 1;
+ if (i <= 0)
+ viewNumber = 12;
+ else
+ viewNumber = i;
+ }
+}
diff --git a/demos/quick2chart/quick2chart.pro b/demos/quick2chart/quick2chart.pro
new file mode 100644
index 00000000..01e77d1f
--- /dev/null
+++ b/demos/quick2chart/quick2chart.pro
@@ -0,0 +1,10 @@
+!include( ../demos.pri ) {
+ error( "Couldn't find the demos.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/quick2chart/*
+
+include(../shared/qtquick2applicationviewer/qtquick2applicationviewer.pri)
+
diff --git a/demos/quick2chart/resources.qrc b/demos/quick2chart/resources.qrc
new file mode 100644
index 00000000..853f4423
--- /dev/null
+++ b/demos/quick2chart/resources.qrc
@@ -0,0 +1,18 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/quick2chart/loader.qml</file>
+ <file>qml/quick2chart/main.qml</file>
+ <file>qml/quick2chart/View1.qml</file>
+ <file>qml/quick2chart/View2.qml</file>
+ <file>qml/quick2chart/View3.qml</file>
+ <file>qml/quick2chart/View4.qml</file>
+ <file>qml/quick2chart/View5.qml</file>
+ <file>qml/quick2chart/View6.qml</file>
+ <file>qml/quick2chart/View7.qml</file>
+ <file>qml/quick2chart/View8.qml</file>
+ <file>qml/quick2chart/View9.qml</file>
+ <file>qml/quick2chart/View10.qml</file>
+ <file>qml/quick2chart/View11.qml</file>
+ <file>qml/quick2chart/View12.qml</file>
+ </qresource>
+</RCC>
diff --git a/demos/quick2oscilloscope/datasource.cpp b/demos/quick2oscilloscope/datasource.cpp
new file mode 100644
index 00000000..751feb6e
--- /dev/null
+++ b/demos/quick2oscilloscope/datasource.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "datasource.h"
+#include <QXYSeries>
+#include <QAreaSeries>
+#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickItem>
+#include <QGLWidget>
+#include <QDebug>
+#include <cmath>
+
+QTCOMMERCIALCHART_USE_NAMESPACE
+
+Q_DECLARE_METATYPE(QAbstractSeries *)
+
+DataSource::DataSource(QQuickView *appViewer, QObject *parent) :
+ QObject(parent),
+ m_appViewer(appViewer),
+ m_index(-1)
+{
+ qRegisterMetaType<QAbstractSeries*>();
+
+ generateData(0, 5, 1024);
+}
+
+void DataSource::update(QAbstractSeries *series)
+{
+ QXYSeries *xySeries = qobject_cast<QXYSeries *>(series);
+ Q_ASSERT(xySeries);
+
+ m_index++;
+ if (m_index > m_data.count() - 1)
+ m_index = 0;
+
+ QList<QPointF> points = m_data.at(m_index);
+ // Use replace instead of clear + append, it's optimized for performance
+ xySeries->replace(points);
+}
+
+void DataSource::generateData(int type, int rowCount, int colCount)
+{
+ // Remove previous data
+ foreach (QList<QPointF> row, m_data)
+ row.clear();
+ m_data.clear();
+
+ // Append the new data depending on the type
+ for (int i(0); i < rowCount; i++) {
+ QList<QPointF> points;
+ for (int j(0); j < colCount; j++) {
+ qreal x(0);
+ qreal y(0);
+ switch (type) {
+ case 0:
+ // data with sin + random component
+ y = sin(3.14159265358979 / 50 * j) + 0.5 + (qreal) rand() / (qreal) RAND_MAX;
+ x = j;
+ break;
+ case 1:
+ // linear data
+ x = j;
+ y = (qreal) i / 10;
+ break;
+ default:
+ // unknown, do nothing
+ break;
+ }
+ points.append(QPointF(x, y));
+ }
+ m_data.append(points);
+ }
+}
diff --git a/demos/quick2oscilloscope/datasource.h b/demos/quick2oscilloscope/datasource.h
new file mode 100644
index 00000000..8f17460b
--- /dev/null
+++ b/demos/quick2oscilloscope/datasource.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DATASOURCE_H
+#define DATASOURCE_H
+
+#include <QObject>
+#include <QAbstractSeries>
+
+class QQuickView;
+
+QTCOMMERCIALCHART_USE_NAMESPACE
+
+class DataSource : public QObject
+{
+ Q_OBJECT
+public:
+ explicit DataSource(QQuickView *appViewer, QObject *parent = 0);
+
+signals:
+
+public slots:
+ void generateData(int type, int rowCount, int colCount);
+ void update(QAbstractSeries *series);
+
+private:
+ QQuickView *m_appViewer;
+ QList<QList<QPointF> > m_data;
+ int m_index;
+};
+
+#endif // DATASOURCE_H
diff --git a/demos/quick2oscilloscope/main.cpp b/demos/quick2oscilloscope/main.cpp
new file mode 100644
index 00000000..f38b7caa
--- /dev/null
+++ b/demos/quick2oscilloscope/main.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlContext>
+#include "qtquick2applicationviewer.h"
+#include "datasource.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+
+ DataSource dataSource(&viewer);
+ viewer.rootContext()->setContextProperty("dataSource", &dataSource);
+
+ viewer.setSource(QUrl("qrc:/qml/quick2oscilloscope/main.qml"));
+ viewer.showExpanded();
+
+ return app.exec();
+}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml
new file mode 100644
index 00000000..12ad8f09
--- /dev/null
+++ b/demos/quick2oscilloscope/qml/quick2oscilloscope/ControlPanel.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Column {
+ spacing: 8
+ signal animationsEnabled(bool enabled)
+ signal seriesTypeChanged(string type)
+ signal refreshRateChanged(variant rate);
+ signal signalSourceChanged(string source, int signalCount, int sampleCount);
+ signal antialiasingEnabled(bool enabled)
+
+ Text {
+ text: "Scope"
+ font.pointSize: 18
+ color: "white"
+ }
+
+ MultiButton {
+ text: "Graph: "
+ items: ["line", "spline", "scatter"]
+ currentSelection: 0
+ onSelectionChanged: seriesTypeChanged(items[currentSelection]);
+ }
+
+ MultiButton {
+ id: signalSourceButton
+ text: "Source: "
+ items: ["sin", "linear"]
+ currentSelection: 0
+ onSelectionChanged: signalSourceChanged(
+ selection,
+ 5,
+ sampleCountButton.items[sampleCountButton.currentSelection]);
+ }
+
+ MultiButton {
+ id: sampleCountButton
+ text: "Samples: "
+ items: [6, 128, 1024, 10000]
+ currentSelection: 2
+ onSelectionChanged: signalSourceChanged(
+ signalSourceButton.items[signalSourceButton.currentSelection],
+ 5,
+ selection);
+ }
+
+ MultiButton {
+ text: "Refresh rate: "
+ items: [1, 24, 60, 100]
+ currentSelection: 2
+ onSelectionChanged: refreshRateChanged(items[currentSelection]);
+ }
+
+ MultiButton {
+ text: "Animations: "
+ items: ["OFF", "ON"]
+ currentSelection: 0
+ onSelectionChanged: animationsEnabled(currentSelection == 1);
+ }
+
+ MultiButton {
+ text: "Antialias: "
+ items: ["OFF", "ON"]
+ currentSelection: 0
+ onSelectionChanged: antialiasingEnabled(currentSelection == 1);
+ }
+}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml
new file mode 100644
index 00000000..1cc47d5a
--- /dev/null
+++ b/demos/quick2oscilloscope/qml/quick2oscilloscope/MultiButton.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: button
+ width: 115
+ height: 31
+ gradient: Gradient {
+ GradientStop { position: mouseArea.pressed ? 1.0 : 0.0; color: "#A09090" }
+ GradientStop { position: mouseArea.pressed ? 0.0 : 1.0; color: "#505050" }
+ }
+ smooth: true
+
+ radius: 7
+ property string text: "Option: "
+ property variant items: ["first"]
+ property int currentSelection: 0
+ signal selectionChanged(variant selection)
+
+ Text {
+ id: buttonText
+ anchors.centerIn: parent
+ color: "#FFFFFF"
+ text: button.text + button.items[currentSelection]
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ currentSelection = (currentSelection + 1) % items.length;
+ selectionChanged(button.items[currentSelection]);
+ }
+ }
+}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml
new file mode 100644
index 00000000..6d12de70
--- /dev/null
+++ b/demos/quick2oscilloscope/qml/quick2oscilloscope/ScopeView.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.2
+
+//![1]
+ChartView {
+ id: chartView
+ animationOptions: ChartView.NoAnimation
+ theme: ChartView.ChartThemeDark
+
+ ValueAxis {
+ id: axisY1
+ min: -1
+ max: 4
+ }
+
+ ValueAxis {
+ id: axisY2
+ min: -10
+ max: 5
+ }
+
+ ValueAxis {
+ id: axisX
+ min: 0
+ max: 1000
+ }
+
+ LineSeries {
+ id: lineSeries1
+ name: "signal 1"
+ axisX: axisX
+ axisY: axisY1
+ }
+ LineSeries {
+ id: lineSeries2
+ name: "signal 2"
+ axisX: axisX
+ axisYRight: axisY2
+ }
+// ...
+//![1]
+
+ //![2]
+ Timer {
+ id: refreshTimer
+ interval: 1 / 60 * 1000 // 60 Hz
+ running: true
+ repeat: true
+ onTriggered: {
+ dataSource.update(chartView.series(0));
+ dataSource.update(chartView.series(1));
+ }
+ }
+ //![2]
+
+ //![3]
+ function changeSeriesType(type) {
+ chartView.removeAllSeries();
+
+ // Create two new series of the correct type. Axis x is the same for both of the series,
+ // but the series have their own y-axes to make it possible to control the y-offset
+ // of the "signal sources".
+ if (type == "line") {
+ chartView.createSeries(ChartView.SeriesTypeLine, "signal 1", axisX, axisY1);
+ chartView.createSeries(ChartView.SeriesTypeLine, "signal 2", axisX, axisY2);
+ } else if (type == "spline") {
+ chartView.createSeries(ChartView.SeriesTypeSpline, "signal 1", axisX, axisY1);
+ chartView.createSeries(ChartView.SeriesTypeSpline, "signal 2", axisX, axisY2);
+ } else {
+ var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1", axisX, axisY1);
+ series1.markerSize = 3;
+ series1.borderColor = "transparent";
+ var series2 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 2", axisX, axisY2);
+ series2.markerSize = 3;
+ series2.borderColor = "transparent";
+ }
+ }
+
+ function createAxis(min, max) {
+ // The following creates a ValueAxis object that can be then set as a x or y axis for a series
+ return Qt.createQmlObject("import QtQuick 1.1; import QtCommercial.Chart 1.1; ValueAxis { min: "
+ + min + "; max: " + max + " }", chartView);
+ }
+ //![3]
+
+ function setAnimations(enabled) {
+ if (enabled)
+ chartView.animationOptions = ChartView.SeriesAnimations;
+ else
+ chartView.animationOptions = ChartView.NoAnimation;
+ }
+
+ function changeRefreshRate(rate) {
+ refreshTimer.interval = 1 / Number(rate) * 1000;
+ }
+}
diff --git a/demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml b/demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml
new file mode 100644
index 00000000..0c31aad9
--- /dev/null
+++ b/demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![3]
+import QtQuick 2.0
+//![3]
+
+//![1]
+Rectangle {
+ id: main
+ width: 400
+ height: 300
+ color: "#404040"
+
+ ControlPanel {
+ id: controlPanel
+ anchors.top: parent.top
+ anchors.topMargin: 10
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+// ...
+//![1]
+
+ onSignalSourceChanged: {
+ if (source == "sin")
+ dataSource.generateData(0, signalCount, sampleCount);
+ else
+ dataSource.generateData(1, signalCount, sampleCount);
+ }
+ onAnimationsEnabled: scopeView.setAnimations(enabled);
+ onSeriesTypeChanged: scopeView.changeSeriesType(type);
+ onRefreshRateChanged: scopeView.changeRefreshRate(rate);
+ onAntialiasingEnabled: scopeView.antialiasing = enabled;
+ }
+
+//![2]
+ ScopeView {
+ id: scopeView
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.left: controlPanel.right
+ height: main.height
+ }
+//![2]
+}
diff --git a/demos/quick2oscilloscope/quick2oscilloscope.pro b/demos/quick2oscilloscope/quick2oscilloscope.pro
new file mode 100644
index 00000000..420bf5cf
--- /dev/null
+++ b/demos/quick2oscilloscope/quick2oscilloscope.pro
@@ -0,0 +1,14 @@
+!include( ../demos.pri ) {
+ error( "Couldn't find the demos.pri file!" )
+}
+
+QT += opengl
+RESOURCES += resources.qrc
+SOURCES += main.cpp \
+ datasource.cpp
+OTHER_FILES += qml/quick2oscilloscope/*
+
+include(../shared/qtquick2applicationviewer/qtquick2applicationviewer.pri)
+
+HEADERS += \
+ datasource.h
diff --git a/demos/quick2oscilloscope/resources.qrc b/demos/quick2oscilloscope/resources.qrc
new file mode 100644
index 00000000..87208ca4
--- /dev/null
+++ b/demos/quick2oscilloscope/resources.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qml/quick2oscilloscope/main.qml</file>
+ <file>qml/quick2oscilloscope/ControlPanel.qml</file>
+ <file>qml/quick2oscilloscope/ScopeView.qml</file>
+ <file>qml/quick2oscilloscope/MultiButton.qml</file>
+ </qresource>
+</RCC>
diff --git a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/shared/qmlapplicationviewer/qmlapplicationviewer.cpp
index 0f12265e..fdd6b9e9 100644
--- a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ b/demos/shared/qmlapplicationviewer/qmlapplicationviewer.cpp
@@ -93,6 +93,7 @@ QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
new QmlJSDebugger::QDeclarativeViewObserver(this, this);
#endif
#endif
+ addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QLatin1String("imports")));
}
QmlApplicationViewer::~QmlApplicationViewer()
diff --git a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h b/demos/shared/qmlapplicationviewer/qmlapplicationviewer.h
index fba2d52a..fba2d52a 100644
--- a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.h
+++ b/demos/shared/qmlapplicationviewer/qmlapplicationviewer.h
diff --git a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/shared/qmlapplicationviewer/qmlapplicationviewer.pri
index 567c6dc6..567c6dc6 100644
--- a/demos/qmlaxes/qmlapplicationviewer/qmlapplicationviewer.pri
+++ b/demos/shared/qmlapplicationviewer/qmlapplicationviewer.pri
diff --git a/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.cpp
new file mode 100644
index 00000000..9d3970fd
--- /dev/null
+++ b/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.cpp
@@ -0,0 +1,71 @@
+// checksum 0x56a9 version 0x80001
+/*
+ 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_MAC)
+ if (!QDir::isAbsolutePath(path))
+ return QString::fromLatin1("%1/../Resources/%2")
+ .arg(QCoreApplication::applicationDirPath(), path);
+#elif defined(Q_OS_UNIX)
+ const QString pathInInstallDir =
+ QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
+ if (QFileInfo(pathInInstallDir).exists())
+ return pathInInstallDir;
+#endif
+ return path;
+}
+
+QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
+ : QQuickView(parent)
+ , d(new QtQuick2ApplicationViewerPrivate())
+{
+ connect(engine(), SIGNAL(quit()), SLOT(close()));
+ setResizeMode(QQuickView::SizeRootObjectToView);
+ addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("qml")));
+}
+
+QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
+{
+ delete d;
+}
+
+void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
+{
+ d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
+ setSource(QUrl::fromLocalFile(d->mainQmlFile));
+}
+
+void QtQuick2ApplicationViewer::addImportPath(const QString &path)
+{
+ engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
+}
+
+void QtQuick2ApplicationViewer::showExpanded()
+{
+#if defined(Q_WS_SIMULATOR)
+ showFullScreen();
+#else
+ show();
+#endif
+}
diff --git a/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.h b/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.h
new file mode 100644
index 00000000..baf67f24
--- /dev/null
+++ b/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.h
@@ -0,0 +1,33 @@
+// checksum 0xfde6 version 0x80001
+/*
+ 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/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.pri b/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.pri
new file mode 100644
index 00000000..b2d0f51d
--- /dev/null
+++ b/demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.pri
@@ -0,0 +1,6 @@
+QT += qml quick widgets
+
+SOURCES += $$PWD/qtquick2applicationviewer.cpp
+HEADERS += $$PWD/qtquick2applicationviewer.h
+INCLUDEPATH += $$PWD
+
diff --git a/doc/src/demos-quick2chart.qdoc b/doc/src/demos-quick2chart.qdoc
new file mode 100644
index 00000000..97206667
--- /dev/null
+++ b/doc/src/demos-quick2chart.qdoc
@@ -0,0 +1,13 @@
+/*!
+ \example demos/quick2chart
+ \title QtQuick 2 charts demo
+ \subtitle
+
+ \image demos_qmlchart1.png
+
+ This is a reimplementation of \l{Qml charts demo} in QtQuick 2.
+
+ Only difference in qml files is importing the correct version of QtQuick:
+
+ \snippet ../demos/quick2chart/qml/quick2chart/View1.qml 2
+*/
diff --git a/doc/src/demos-quick2oscilloscope.qdoc b/doc/src/demos-quick2oscilloscope.qdoc
new file mode 100644
index 00000000..e322760c
--- /dev/null
+++ b/doc/src/demos-quick2oscilloscope.qdoc
@@ -0,0 +1,16 @@
+/*!
+ \example demos/quick2oscilloscope
+ \title QtQuick 2 Oscilloscope
+
+ \image demos_qmloscilloscope.png
+
+ This is a reimplementation of \l{Oscilloscope} demo in QtQuick 2.
+
+ Only difference in qml files is importing the correct version of QtQuick:
+
+ \snippet ../demos/quick2oscilloscope/qml/quick2oscilloscope/main.qml 3
+
+ \note QML_SHOW_FRAMERATE environment variable doesn't work with QtQuick 2.
+ Starting with Qt 5.1.0, QSG_RENDER_TIMING environment variable can be used
+ similarly to display rendering time.
+*/
diff --git a/doc/src/demos.qdoc b/doc/src/demos.qdoc
index 6316617a..7ab113ed 100644
--- a/doc/src/demos.qdoc
+++ b/doc/src/demos.qdoc
@@ -65,9 +65,17 @@
</tr>
<tr>
<td><a href="demos-qmlpolarchart.html">Qml Polar Chart</a></td>
+ <td><a href="demos-quick2chart.html">QtQuick 2 Basic Charts</a></td>
</tr>
<tr>
<td><a href="demos-qmlpolarchart.html"><img src="images/demos_qmlpolarchart1.png" width="300" alt="Qml Polar Chart" /></a></td>
+ <td><a href="demos-quick2chart.html"><img src="images/demos_qmlchart1.png" width="300" alt="QtQuick 2 Basic Charts" /></a></td>
+ </tr>
+ <tr>
+ <td><a href="demos-quick2oscilloscope.html">QtQuick 2 Oscilloscope</a></td>
+ </tr>
+ <tr>
+ <td><a href="demos-quick2oscilloscope.html"><img src="images/demos_qmloscilloscope.png" width="300" alt="QtQuick 2 Oscilloscope" /></a></td>
</tr>
</table>
</div>
diff --git a/doc/src/qml.qdoc b/doc/src/qml.qdoc
index d7fae7e6..a6716a6e 100644
--- a/doc/src/qml.qdoc
+++ b/doc/src/qml.qdoc
@@ -18,6 +18,12 @@
\o \inlineimage examples_qmlpiechart.png
\endtable
+ \note Since QtCommercial Charts utilizes Qt Graphics View Framework for drawing, it works best
+ with QtQuick 1, which is based on the same framework.
+ As of release 1.3.0, QtCommercial Charts is also usable with QtQuick 2, though the performance
+ is slightly worse than with QtQuick 1. Also, hovered and clicked signals of series do not work
+ with QtQuick 2.
+
\raw HTML
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable">
<tr>
diff --git a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h b/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h
deleted file mode 100644
index fba2d52a..00000000
--- a/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/qmlpiechart/qmlapplicationviewer/qmlapplicationviewer.pri
deleted file mode 100644
index 567c6dc6..00000000
--- a/examples/qmlpiechart/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/examples/qmlpiechart/qmlpiechart.pro b/examples/qmlpiechart/qmlpiechart.pro
index c8e6fa31..9a65ce52 100644
--- a/examples/qmlpiechart/qmlpiechart.pro
+++ b/examples/qmlpiechart/qmlpiechart.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../../demos/shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/plugins/declarative/declarative.pri b/plugins/declarative/declarative.pri
new file mode 100644
index 00000000..305e6861
--- /dev/null
+++ b/plugins/declarative/declarative.pri
@@ -0,0 +1,58 @@
+!include( ../plugins.pri ) {
+ error( "Couldn't find the plugins.pri file!" )
+}
+
+contains(DEFINES, CHARTS_FOR_QUICK2) {
+ DESTDIR = $$CHART_BUILD_QML2_PLUGIN_DIR
+} else {
+ DESTDIR = $$CHART_BUILD_QML_PLUGIN_DIR
+}
+
+INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR
+
+CONFIG(debug, debug|release) {
+ mac: TARGET = $$join(TARGET,,,_debug)
+ win32: TARGET = $$join(TARGET,,,d)
+}
+
+SOURCES += \
+ ../declarative/plugin.cpp \
+ ../declarative/declarativechart.cpp \
+ ../declarative/declarativexypoint.cpp \
+ ../declarative/declarativexyseries.cpp \
+ ../declarative/declarativelineseries.cpp \
+ ../declarative/declarativesplineseries.cpp \
+ ../declarative/declarativeareaseries.cpp \
+ ../declarative/declarativescatterseries.cpp \
+ ../declarative/declarativepieseries.cpp \
+ ../declarative/declarativebarseries.cpp \
+ ../declarative/declarativecategoryaxis.cpp \
+ ../declarative/declarativemargins.cpp \
+ ../declarative/declarativeaxes.cpp \
+ ../declarative/declarativepolarchart.cpp
+
+HEADERS += \
+ ../declarative/declarativechart.h \
+ ../declarative/declarativexypoint.h \
+ ../declarative/declarativexyseries.h \
+ ../declarative/declarativelineseries.h \
+ ../declarative/declarativesplineseries.h \
+ ../declarative/declarativeareaseries.h \
+ ../declarative/declarativescatterseries.h \
+ ../declarative/declarativepieseries.h \
+ ../declarative/declarativebarseries.h \
+ ../declarative/declarativecategoryaxis.h \
+ ../declarative/declarativemargins.h \
+ ../declarative/declarativeaxes.h \
+ ../declarative/declarativepolarchart.h \
+ ../declarative/shared_defines.h
+
+TARGETPATH = QtCommercial/Chart
+target.path = $$IMPORT_INSTALL_PATH/$$TARGETPATH
+qmldir.files += $$_PRO_FILE_PWD_/qmldir
+qmldir.path += $$IMPORT_INSTALL_PATH/$$TARGETPATH
+INSTALLS += target qmldir
+
+QMLDIR_FILE = $$_PRO_FILE_PWD_/qmldir
+win32:QMLDIR_FILE = $$replace(QMLDIR_FILE, "/","\\")
+QMAKE_POST_LINK += $$QMAKE_COPY $$QMLDIR_FILE $$DESTDIR
diff --git a/plugins/declarative/declarative.pro b/plugins/declarative/declarative.pro
deleted file mode 100644
index 12d48832..00000000
--- a/plugins/declarative/declarative.pro
+++ /dev/null
@@ -1,54 +0,0 @@
-!include( ../plugins.pri ) {
- error( "Couldn't find the plugins.pri file!" )
-}
-
-TARGET = qtcommercialchartqml
-QT += declarative
-DESTDIR = $$CHART_BUILD_QML_PLUGIN_DIR
-INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR
-
-CONFIG(debug, debug|release) {
- mac: TARGET = $$join(TARGET,,,_debug)
- win32: TARGET = $$join(TARGET,,,d)
-}
-
-SOURCES += \
- plugin.cpp \
- declarativechart.cpp \
- declarativexypoint.cpp \
- declarativexyseries.cpp \
- declarativelineseries.cpp \
- declarativesplineseries.cpp \
- declarativeareaseries.cpp \
- declarativescatterseries.cpp \
- declarativepieseries.cpp \
- declarativebarseries.cpp \
- declarativecategoryaxis.cpp \
- declarativemargins.cpp \
- declarativeaxes.cpp \
- declarativepolarchart.cpp
-
-HEADERS += \
- declarativechart.h \
- declarativexypoint.h \
- declarativexyseries.h \
- declarativelineseries.h \
- declarativesplineseries.h \
- declarativeareaseries.h \
- declarativescatterseries.h \
- declarativepieseries.h \
- declarativebarseries.h \
- declarativecategoryaxis.h \
- declarativemargins.h \
- declarativeaxes.h \
- declarativepolarchart.h
-
-TARGETPATH = QtCommercial/Chart
-target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
-qmldir.files += $$PWD/qmldir
-qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
-INSTALLS += target qmldir
-
-FILE = $$PWD/qmldir
-win32:{FILE = $$replace(FILE, "/","\\")}
-QMAKE_POST_LINK += $$QMAKE_COPY $$FILE $$CHART_BUILD_QML_PLUGIN_DIR
diff --git a/plugins/declarative/declarativebarseries.cpp b/plugins/declarative/declarativebarseries.cpp
index 9133141a..2bff984b 100644
--- a/plugins/declarative/declarativebarseries.cpp
+++ b/plugins/declarative/declarativebarseries.cpp
@@ -74,7 +74,7 @@ void DeclarativeBarSet::setValues(QVariantList values)
}
// Declarative bar series ======================================================================================
-DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) :
+DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) :
QBarSeries(parent),
m_axes(new DeclarativeAxes(this))
{
@@ -103,12 +103,12 @@ void DeclarativeBarSeries::componentComplete()
}
}
-QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeBarSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativeBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
@@ -136,7 +136,7 @@ DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVaria
}
// Declarative stacked bar series ==============================================================================
-DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDeclarativeItem *parent) :
+DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent) :
QStackedBarSeries(parent),
m_axes(0)
{
@@ -167,12 +167,12 @@ void DeclarativeStackedBarSeries::componentComplete()
}
-QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeStackedBarSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativeStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
@@ -200,7 +200,7 @@ DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label,
}
// Declarative percent bar series ==============================================================================
-DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDeclarativeItem *parent) :
+DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent) :
QPercentBarSeries(parent),
m_axes(0)
{
@@ -230,12 +230,12 @@ void DeclarativePercentBarSeries::componentComplete()
}
}
-QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePercentBarSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativePercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
@@ -263,7 +263,7 @@ DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label,
}
// Declarative horizontal bar series ===========================================================================
-DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QDeclarativeItem *parent) :
+DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent) :
QHorizontalBarSeries(parent),
m_axes(0)
{
@@ -293,12 +293,12 @@ void DeclarativeHorizontalBarSeries::componentComplete()
}
}
-QDeclarativeListProperty<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeHorizontalBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativeHorizontalBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
@@ -326,7 +326,7 @@ DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString lab
}
// Declarative horizontal stacked bar series ===================================================================
-DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QDeclarativeItem *parent) :
+DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent) :
QHorizontalStackedBarSeries(parent),
m_axes(0)
{
@@ -356,12 +356,12 @@ void DeclarativeHorizontalStackedBarSeries::componentComplete()
}
}
-QDeclarativeListProperty<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
@@ -389,7 +389,7 @@ DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QStr
}
// Declarative horizontal percent bar series ===================================================================
-DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QDeclarativeItem *parent) :
+DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent) :
QHorizontalPercentBarSeries(parent),
m_axes(0)
{
@@ -419,12 +419,12 @@ void DeclarativeHorizontalPercentBarSeries::componentComplete()
}
}
-QDeclarativeListProperty<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
diff --git a/plugins/declarative/declarativebarseries.h b/plugins/declarative/declarativebarseries.h
index 8e63fcbb..7d8f99cf 100644
--- a/plugins/declarative/declarativebarseries.h
+++ b/plugins/declarative/declarativebarseries.h
@@ -29,8 +29,15 @@
#include "qhorizontalpercentbarseries.h"
#include "qbarset.h"
#include "declarativeaxes.h"
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlParserStatus>
+#else
#include <QtDeclarative/QDeclarativeItem>
#include <QtDeclarative/QDeclarativeParserStatus>
+#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -64,19 +71,27 @@ private Q_SLOTS:
void handleCountChanged(int index, int count);
};
-class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus
+class DeclarativeBarSeries : public QBarSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0);
+ explicit DeclarativeBarSeries(QDECLARATIVE_ITEM *parent = 0);
QAbstractAxis *axisX() { return m_axes->axisX(); }
void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
QAbstractAxis *axisY() { return m_axes->axisY(); }
@@ -85,7 +100,7 @@ public:
Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDeclarativeListProperty<QObject> seriesChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
public:
Q_INVOKABLE DeclarativeBarSet *at(int index);
@@ -105,25 +120,33 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
public:
DeclarativeAxes *m_axes;
};
-class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus
+class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0);
+ explicit DeclarativeStackedBarSeries(QDECLARATIVE_ITEM *parent = 0);
QAbstractAxis *axisX() { return m_axes->axisX(); }
void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
QAbstractAxis *axisY() { return m_axes->axisY(); }
@@ -132,7 +155,7 @@ public:
Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDeclarativeListProperty<QObject> seriesChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
public:
Q_INVOKABLE DeclarativeBarSet *at(int index);
@@ -152,25 +175,33 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
public:
DeclarativeAxes *m_axes;
};
-class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus
+class DeclarativePercentBarSeries : public QPercentBarSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0);
+ explicit DeclarativePercentBarSeries(QDECLARATIVE_ITEM *parent = 0);
QAbstractAxis *axisX() { return m_axes->axisX(); }
void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
QAbstractAxis *axisY() { return m_axes->axisY(); }
@@ -179,7 +210,7 @@ public:
Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDeclarativeListProperty<QObject> seriesChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
public:
Q_INVOKABLE DeclarativeBarSet *at(int index);
@@ -199,25 +230,33 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
public:
DeclarativeAxes *m_axes;
};
-class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDeclarativeParserStatus
+class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativeHorizontalBarSeries(QDeclarativeItem *parent = 0);
+ explicit DeclarativeHorizontalBarSeries(QDECLARATIVE_ITEM *parent = 0);
QAbstractAxis *axisX() { return m_axes->axisX(); }
void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
QAbstractAxis *axisY() { return m_axes->axisY(); }
@@ -226,7 +265,7 @@ public:
Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDeclarativeListProperty<QObject> seriesChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
public:
Q_INVOKABLE DeclarativeBarSet *at(int index);
@@ -246,25 +285,33 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
public:
DeclarativeAxes *m_axes;
};
-class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDeclarativeParserStatus
+class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativeHorizontalStackedBarSeries(QDeclarativeItem *parent = 0);
+ explicit DeclarativeHorizontalStackedBarSeries(QDECLARATIVE_ITEM *parent = 0);
QAbstractAxis *axisX() { return m_axes->axisX(); }
void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
QAbstractAxis *axisY() { return m_axes->axisY(); }
@@ -273,7 +320,7 @@ public:
Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDeclarativeListProperty<QObject> seriesChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
public:
Q_INVOKABLE DeclarativeBarSet *at(int index);
@@ -293,25 +340,33 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
public:
DeclarativeAxes *m_axes;
};
-class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDeclarativeParserStatus
+class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged REVISION 2)
Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged REVISION 2)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativeHorizontalPercentBarSeries(QDeclarativeItem *parent = 0);
+ explicit DeclarativeHorizontalPercentBarSeries(QDECLARATIVE_ITEM *parent = 0);
QAbstractAxis *axisX() { return m_axes->axisX(); }
void setAxisX(QAbstractAxis *axis) { m_axes->setAxisX(axis); }
QAbstractAxis *axisY() { return m_axes->axisY(); }
@@ -320,7 +375,7 @@ public:
Q_REVISION(2) void setAxisXTop(QAbstractAxis *axis) { m_axes->setAxisXTop(axis); }
Q_REVISION(2) QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
Q_REVISION(2) void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
- QDeclarativeListProperty<QObject> seriesChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
public:
Q_INVOKABLE DeclarativeBarSet *at(int index);
@@ -340,7 +395,7 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
public:
DeclarativeAxes *m_axes;
diff --git a/plugins/declarative/declarativecategoryaxis.cpp b/plugins/declarative/declarativecategoryaxis.cpp
index 4e2c4fa5..dbe37f11 100644
--- a/plugins/declarative/declarativecategoryaxis.cpp
+++ b/plugins/declarative/declarativecategoryaxis.cpp
@@ -66,9 +66,9 @@ bool DeclarativeCategoryAxis::endValueLessThan(const QPair<QString, qreal> &valu
return value1.second < value2.second;
}
-QDeclarativeListProperty<QObject> DeclarativeCategoryAxis::axisChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeCategoryAxis::axisChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeCategoryAxis::appendAxisChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativeCategoryAxis::appendAxisChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
void DeclarativeCategoryAxis::append(const QString &label, qreal categoryEndValue)
@@ -86,7 +86,7 @@ void DeclarativeCategoryAxis::replace(const QString &oldLabel, const QString &ne
QCategoryAxis::replaceLabel(oldLabel, newLabel);
}
-void DeclarativeCategoryAxis::appendAxisChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
+void DeclarativeCategoryAxis::appendAxisChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list)
diff --git a/plugins/declarative/declarativecategoryaxis.h b/plugins/declarative/declarativecategoryaxis.h
index 5e17bab3..6e718d78 100644
--- a/plugins/declarative/declarativecategoryaxis.h
+++ b/plugins/declarative/declarativecategoryaxis.h
@@ -22,8 +22,15 @@
#define DECLARATIVECATEGORYAXIS_H
#include "qcategoryaxis.h"
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+#else
#include <QtDeclarative/QDeclarativeListProperty>
#include <QtDeclarative/QDeclarativeParserStatus>
+#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -45,16 +52,21 @@ private:
QString m_label;
};
-class DeclarativeCategoryAxis : public QCategoryAxis, public QDeclarativeParserStatus
+class DeclarativeCategoryAxis : public QCategoryAxis, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> axisChildren READ axisChildren)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QDeclarativeListProperty<QObject> axisChildren READ axisChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "axisChildren")
public:
explicit DeclarativeCategoryAxis(QObject *parent = 0);
- QDeclarativeListProperty<QObject> axisChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> axisChildren();
public: // from QDeclarativeParserStatus
void classBegin();
@@ -64,7 +76,7 @@ public Q_SLOTS:
Q_INVOKABLE void append(const QString &label, qreal categoryEndValue);
Q_INVOKABLE void remove(const QString &label);
Q_INVOKABLE void replace(const QString &oldLabel, const QString &newLabel);
- static void appendAxisChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendAxisChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
private:
static bool endValueLessThan(const QPair<QString, qreal> &value1, const QPair<QString, qreal> &value2);
diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp
index 344f5e62..c81bbdcc 100644
--- a/plugins/declarative/declarativechart.cpp
+++ b/plugins/declarative/declarativechart.cpp
@@ -20,7 +20,6 @@
#include "declarativechart.h"
#include <QPainter>
-#include <QDeclarativeEngine>
#include "declarativelineseries.h"
#include "declarativeareaseries.h"
#include "declarativebarseries.h"
@@ -235,26 +234,41 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
object after the signal handler has completed.
*/
-DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+DeclarativeChart::DeclarativeChart(QDECLARATIVE_ITEM *parent)
+ : QDECLARATIVE_PAINTED_ITEM(parent)
{
initChart(QChart::ChartTypeCartesian);
}
-DeclarativeChart::DeclarativeChart(QChart::ChartType type, QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
+DeclarativeChart::DeclarativeChart(QChart::ChartType type, QDECLARATIVE_ITEM *parent)
+ : QDECLARATIVE_PAINTED_ITEM(parent)
{
initChart(type);
}
void DeclarativeChart::initChart(QChart::ChartType type)
{
+#ifdef CHARTS_FOR_QUICK2
+ if (type == QChart::ChartTypePolar)
+ m_chart = new QPolarChart();
+ else
+ m_chart = new QChart();
+
+ m_scene = new QGraphicsScene(this);
+ m_scene->addItem(m_chart);
+
+ setAntialiasing(QQuickItem::antialiasing());
+ connect(m_scene, SIGNAL(changed(QList<QRectF>)), this, SLOT(update()));
+ connect(this, SIGNAL(antialiasingChanged(bool)), this, SLOT(handleAntialiasingChanged(bool)));
+#else
if (type == QChart::ChartTypePolar)
m_chart = new QPolarChart(this);
else
m_chart = new QChart(this);
setFlag(QGraphicsItem::ItemHasNoContents, false);
+#endif
+
m_margins = new DeclarativeMargins(this);
m_margins->setTop(m_chart->margins().top());
m_margins->setLeft(m_chart->margins().left());
@@ -314,7 +328,7 @@ void DeclarativeChart::componentComplete()
}
}
- QDeclarativeItem::componentComplete();
+ QDECLARATIVE_ITEM::componentComplete();
}
void DeclarativeChart::handleAxisXSet(QAbstractAxis *axis)
@@ -377,7 +391,7 @@ void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &
m_chart->resize(newGeometry.width(), newGeometry.height());
}
}
- QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+ QDECLARATIVE_ITEM::geometryChanged(newGeometry, oldGeometry);
// It would be better to trigger the plotAreaChanged signal from QChart::plotAreaChanged or
// similar. Since that kind of a signal is not clearly needed in the C++ API the work-around is
@@ -385,6 +399,19 @@ void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &
emit plotAreaChanged(m_chart->plotArea());
}
+#ifdef CHARTS_FOR_QUICK2
+void DeclarativeChart::paint(QPainter *painter)
+{
+ QRectF renderRect(QPointF(0, 0), m_chart->size());
+ m_scene->render(painter, renderRect, renderRect);
+}
+
+void DeclarativeChart::handleAntialiasingChanged(bool enable)
+{
+ setAntialiasing(enable);
+}
+#endif
+
void DeclarativeChart::setTheme(DeclarativeChart::Theme theme)
{
QChart::ChartTheme chartTheme = (QChart::ChartTheme) theme;
@@ -555,22 +582,27 @@ void DeclarativeChart::scrollDown(qreal pixels)
m_chart->scroll(0, -pixels);
}
-QDeclarativeListProperty<QAbstractAxis> DeclarativeChart::axes()
+QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> DeclarativeChart::axes()
{
- return QDeclarativeListProperty<QAbstractAxis>(this, 0,
+ return QDECLARATIVE_LIST_PROPERTY<QAbstractAxis>(this, 0,
&DeclarativeChart::axesAppendFunc,
&DeclarativeChart::axesCountFunc,
+#ifdef CHARTS_FOR_QUICK2
+ &DeclarativeChart::axesAtFunc,
+ &DeclarativeChart::axesClearFunc);
+#else
&DeclarativeChart::axesAtFunc);
+#endif
}
-void DeclarativeChart::axesAppendFunc(QDeclarativeListProperty<QAbstractAxis> *list, QAbstractAxis *element)
+void DeclarativeChart::axesAppendFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, QAbstractAxis *element)
{
// Empty implementation
Q_UNUSED(list);
Q_UNUSED(element);
}
-int DeclarativeChart::axesCountFunc(QDeclarativeListProperty<QAbstractAxis> *list)
+int DeclarativeChart::axesCountFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list)
{
if (qobject_cast<DeclarativeChart *>(list->object)) {
DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object);
@@ -579,7 +611,7 @@ int DeclarativeChart::axesCountFunc(QDeclarativeListProperty<QAbstractAxis> *lis
return 0;
}
-QAbstractAxis *DeclarativeChart::axesAtFunc(QDeclarativeListProperty<QAbstractAxis> *list, int index)
+QAbstractAxis *DeclarativeChart::axesAtFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, int index)
{
if (qobject_cast<DeclarativeChart *>(list->object)) {
DeclarativeChart *chart = qobject_cast<DeclarativeChart *>(list->object);
@@ -589,6 +621,13 @@ QAbstractAxis *DeclarativeChart::axesAtFunc(QDeclarativeListProperty<QAbstractAx
return 0;
}
+void DeclarativeChart::axesClearFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list)
+{
+ // Empty implementation
+ Q_UNUSED(list);
+}
+
+
QAbstractSeries *DeclarativeChart::series(int index)
{
if (index < m_chart->series().count()) {
diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h
index cc6295e7..c02434e4 100644
--- a/plugins/declarative/declarativechart.h
+++ b/plugins/declarative/declarativechart.h
@@ -22,7 +22,15 @@
#define DECLARATIVECHART_H
#include <QtCore/QtGlobal>
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQuick/QQuickItem>
+#include <QtQuick/QQuickPaintedItem>
+#include <QtWidgets/QGraphicsScene>
+#else
#include <QtDeclarative/QDeclarativeItem>
+#endif
#include "qchart.h"
@@ -32,7 +40,7 @@ class DeclarativeMargins;
class Domain;
class DeclarativeAxes;
-class DeclarativeChart : public QDeclarativeItem
+class DeclarativeChart : public QDECLARATIVE_PAINTED_ITEM
{
Q_OBJECT
Q_PROPERTY(Theme theme READ theme WRITE setTheme)
@@ -51,7 +59,11 @@ class DeclarativeChart : public QDeclarativeItem
Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins NOTIFY minimumMarginsChanged REVISION 1)
Q_PROPERTY(DeclarativeMargins *margins READ margins NOTIFY marginsChanged REVISION 2)
Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QAbstractAxis> axes READ axes REVISION 2)
+#else
Q_PROPERTY(QDeclarativeListProperty<QAbstractAxis> axes READ axes REVISION 2)
+#endif
Q_ENUMS(Animation)
Q_ENUMS(Theme)
Q_ENUMS(SeriesType)
@@ -90,13 +102,18 @@ public:
};
public:
- DeclarativeChart(QDeclarativeItem *parent = 0);
+ DeclarativeChart(QDECLARATIVE_ITEM *parent = 0);
~DeclarativeChart();
-public: // From QDeclarativeItem/QGraphicsItem
+public: // From parent classes
void childEvent(QChildEvent *event);
void componentComplete();
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+#ifdef CHARTS_FOR_QUICK2
+ void paint(QPainter *painter);
+private Q_SLOTS:
+ void handleAntialiasingChanged(bool enable);
+#endif
public:
void setTheme(DeclarativeChart::Theme theme);
@@ -129,10 +146,11 @@ public:
QAbstractAxis *defaultAxis(Qt::Orientation orientation, QAbstractSeries *series);
void initializeAxes(QAbstractSeries *series);
void doInitializeAxes(QAbstractSeries *series, DeclarativeAxes *axes);
- QDeclarativeListProperty<QAbstractAxis> axes();
- static void axesAppendFunc(QDeclarativeListProperty<QAbstractAxis> *list, QAbstractAxis *element);
- static int axesCountFunc(QDeclarativeListProperty<QAbstractAxis> *list);
- static QAbstractAxis *axesAtFunc(QDeclarativeListProperty<QAbstractAxis> *list, int index);
+ QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> axes();
+ static void axesAppendFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, QAbstractAxis *element);
+ static int axesCountFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list);
+ static QAbstractAxis *axesAtFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list, int index);
+ static void axesClearFunc(QDECLARATIVE_LIST_PROPERTY<QAbstractAxis> *list);
public:
Q_INVOKABLE QAbstractSeries *series(int index);
@@ -171,14 +189,16 @@ private Q_SLOTS:
void handleSeriesAdded(QAbstractSeries *series);
protected:
- explicit DeclarativeChart(QChart::ChartType type, QDeclarativeItem *parent);
+ explicit DeclarativeChart(QChart::ChartType type, QDECLARATIVE_ITEM *parent);
private:
void initChart(QChart::ChartType type);
// Extending QChart with DeclarativeChart is not possible because QObject does not support
// multi inheritance, so we now have a QChart as a member instead
QChart *m_chart;
- //QMargins m_chartMargins;
+#ifdef CHARTS_FOR_QUICK2
+ QGraphicsScene *m_scene;
+#endif
DeclarativeMargins *m_margins;
};
diff --git a/plugins/declarative/declarativelineseries.cpp b/plugins/declarative/declarativelineseries.cpp
index 735b2962..7fed7cd1 100644
--- a/plugins/declarative/declarativelineseries.cpp
+++ b/plugins/declarative/declarativelineseries.cpp
@@ -87,12 +87,12 @@ void DeclarativeLineSeries::setCapStyle(Qt::PenCapStyle capStyle)
}
}
-QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeLineSeries::declarativeChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
+void DeclarativeLineSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
{
Q_UNUSED(list)
Q_UNUSED(element)
diff --git a/plugins/declarative/declarativelineseries.h b/plugins/declarative/declarativelineseries.h
index 05222a6d..a3fd19b9 100644
--- a/plugins/declarative/declarativelineseries.h
+++ b/plugins/declarative/declarativelineseries.h
@@ -24,15 +24,26 @@
#include "qlineseries.h"
#include "declarativexyseries.h"
#include "declarativeaxes.h"
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+#else
#include <QtDeclarative/QDeclarativeListProperty>
#include <QtDeclarative/QDeclarativeParserStatus>
+#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
+class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
@@ -43,7 +54,11 @@ class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, pu
Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1)
Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1)
Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "declarativeChildren")
public:
@@ -67,7 +82,7 @@ public:
void setStyle(Qt::PenStyle style);
Qt::PenCapStyle capStyle() const;
void setCapStyle(Qt::PenCapStyle capStyle);
- QDeclarativeListProperty<QObject> declarativeChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
@@ -94,7 +109,7 @@ Q_SIGNALS:
Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle);
public Q_SLOTS:
- static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
void handleCountChanged(int index);
public:
diff --git a/plugins/declarative/declarativepieseries.cpp b/plugins/declarative/declarativepieseries.cpp
index 46a52938..6764f5a6 100644
--- a/plugins/declarative/declarativepieseries.cpp
+++ b/plugins/declarative/declarativepieseries.cpp
@@ -25,7 +25,7 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
-DeclarativePieSeries::DeclarativePieSeries(QDeclarativeItem *parent) :
+DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) :
QPieSeries(parent)
{
connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
@@ -51,12 +51,12 @@ void DeclarativePieSeries::componentComplete()
}
}
-QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativePieSeries::seriesChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
+void DeclarativePieSeries::appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> * list, QObject *element)
{
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
diff --git a/plugins/declarative/declarativepieseries.h b/plugins/declarative/declarativepieseries.h
index 2440990a..7c6c8f13 100644
--- a/plugins/declarative/declarativepieseries.h
+++ b/plugins/declarative/declarativepieseries.h
@@ -22,22 +22,34 @@
#define DECLARATIVEPIESERIES_H
#include "qpieseries.h"
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQuick/QQuickItem>
+#include <QtQml/QQmlParserStatus>
+#else
#include <QtDeclarative/QDeclarativeItem>
#include <QtDeclarative/QDeclarativeParserStatus>
+#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
class QPieSlice;
-class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus
+class DeclarativePieSeries : public QPieSeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> seriesChildren READ seriesChildren)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
- explicit DeclarativePieSeries(QDeclarativeItem *parent = 0);
- QDeclarativeListProperty<QObject> seriesChildren();
+ explicit DeclarativePieSeries(QDECLARATIVE_ITEM *parent = 0);
+ QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
Q_INVOKABLE QPieSlice *at(int index);
Q_INVOKABLE QPieSlice *find(QString label);
Q_INVOKABLE QPieSlice *append(QString label, qreal value);
@@ -53,7 +65,7 @@ Q_SIGNALS:
void sliceRemoved(QPieSlice *slice);
public Q_SLOTS:
- static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
void handleAdded(QList<QPieSlice *> slices);
void handleRemoved(QList<QPieSlice *> slices);
};
diff --git a/plugins/declarative/declarativepolarchart.cpp b/plugins/declarative/declarativepolarchart.cpp
index 3be90d78..25c2ece8 100644
--- a/plugins/declarative/declarativepolarchart.cpp
+++ b/plugins/declarative/declarativepolarchart.cpp
@@ -50,7 +50,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
\clearfloat
*/
-DeclarativePolarChart::DeclarativePolarChart(QDeclarativeItem *parent)
+DeclarativePolarChart::DeclarativePolarChart(QDECLARATIVE_ITEM *parent)
: DeclarativeChart(QChart::ChartTypePolar, parent)
{
}
diff --git a/plugins/declarative/declarativepolarchart.h b/plugins/declarative/declarativepolarchart.h
index 598de6ea..96c3e0c8 100644
--- a/plugins/declarative/declarativepolarchart.h
+++ b/plugins/declarative/declarativepolarchart.h
@@ -22,7 +22,14 @@
#define DECLARATIVEPOLARCHART_H
#include <QtCore/QtGlobal>
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQuick/QQuickItem>
+#else
#include <QtDeclarative/QDeclarativeItem>
+#endif
+
#include "declarativechart.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -31,7 +38,7 @@ class DeclarativePolarChart : public DeclarativeChart
{
Q_OBJECT
public:
- DeclarativePolarChart(QDeclarativeItem *parent = 0);
+ DeclarativePolarChart(QDECLARATIVE_ITEM *parent = 0);
~DeclarativePolarChart();
};
diff --git a/plugins/declarative/declarativescatterseries.cpp b/plugins/declarative/declarativescatterseries.cpp
index af7b41a6..dedc99f1 100644
--- a/plugins/declarative/declarativescatterseries.cpp
+++ b/plugins/declarative/declarativescatterseries.cpp
@@ -57,12 +57,12 @@ void DeclarativeScatterSeries::setBorderWidth(qreal width)
}
}
-QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeScatterSeries::declarativeChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
+void DeclarativeScatterSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
{
Q_UNUSED(list)
Q_UNUSED(element)
diff --git a/plugins/declarative/declarativescatterseries.h b/plugins/declarative/declarativescatterseries.h
index 2400242c..549e5ff7 100644
--- a/plugins/declarative/declarativescatterseries.h
+++ b/plugins/declarative/declarativescatterseries.h
@@ -24,15 +24,26 @@
#include "qscatterseries.h"
#include "declarativexyseries.h"
#include "declarativeaxes.h"
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+#else
#include <QtDeclarative/QDeclarativeListProperty>
#include <QtDeclarative/QDeclarativeParserStatus>
+#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
+class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
@@ -41,7 +52,11 @@ class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeri
Q_PROPERTY(QAbstractAxis *axisAngular READ axisAngular WRITE setAxisAngular NOTIFY axisAngularChanged REVISION 3)
Q_PROPERTY(QAbstractAxis *axisRadial READ axisRadial WRITE setAxisRadial NOTIFY axisRadialChanged REVISION 3)
Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "declarativeChildren")
public:
@@ -61,7 +76,7 @@ public:
Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
qreal borderWidth() const;
void setBorderWidth(qreal borderWidth);
- QDeclarativeListProperty<QObject> declarativeChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
@@ -86,7 +101,7 @@ Q_SIGNALS:
Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
public Q_SLOTS:
- static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
void handleCountChanged(int index);
public:
diff --git a/plugins/declarative/declarativesplineseries.cpp b/plugins/declarative/declarativesplineseries.cpp
index f3900413..1acc91cb 100644
--- a/plugins/declarative/declarativesplineseries.cpp
+++ b/plugins/declarative/declarativesplineseries.cpp
@@ -87,12 +87,12 @@ void DeclarativeSplineSeries::setCapStyle(Qt::PenCapStyle capStyle)
}
}
-QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren()
+QDECLARATIVE_LIST_PROPERTY<QObject> DeclarativeSplineSeries::declarativeChildren()
{
- return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren);
+ return QDECLARATIVE_LIST_PROPERTY<QObject>(this, 0, &appendDeclarativeChildren LIST_PROPERTY_PARAM_DEFAULTS);
}
-void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element)
+void DeclarativeSplineSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element)
{
Q_UNUSED(list)
Q_UNUSED(element)
diff --git a/plugins/declarative/declarativesplineseries.h b/plugins/declarative/declarativesplineseries.h
index cfa0a7ee..6d256e62 100644
--- a/plugins/declarative/declarativesplineseries.h
+++ b/plugins/declarative/declarativesplineseries.h
@@ -24,15 +24,26 @@
#include "qsplineseries.h"
#include "declarativexyseries.h"
#include "declarativeaxes.h"
+#include "shared_defines.h"
+
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQml/QQmlListProperty>
+#include <QtQml/QQmlParserStatus>
+#else
#include <QtDeclarative/QDeclarativeListProperty>
#include <QtDeclarative/QDeclarativeParserStatus>
+#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus
+class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDECLARATIVE_PARSER_STATUS
{
Q_OBJECT
+#ifdef CHARTS_FOR_QUICK2
+ Q_INTERFACES(QQmlParserStatus)
+#else
Q_INTERFACES(QDeclarativeParserStatus)
+#endif
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1)
Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1)
@@ -43,7 +54,11 @@ class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries
Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1)
Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1)
Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1)
+#ifdef CHARTS_FOR_QUICK2
+ Q_PROPERTY(QQmlListProperty<QObject> declarativeChildren READ declarativeChildren)
+#else
Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
+#endif
Q_CLASSINFO("DefaultProperty", "declarativeChildren")
public:
@@ -67,7 +82,7 @@ public:
void setStyle(Qt::PenStyle style);
Qt::PenCapStyle capStyle() const;
void setCapStyle(Qt::PenCapStyle capStyle);
- QDeclarativeListProperty<QObject> declarativeChildren();
+ QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
@@ -94,7 +109,7 @@ Q_SIGNALS:
Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle);
public Q_SLOTS:
- static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
+ static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
void handleCountChanged(int index);
public:
diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp
index bf560e59..dd060212 100644
--- a/plugins/declarative/plugin.cpp
+++ b/plugins/declarative/plugin.cpp
@@ -47,9 +47,14 @@
#ifndef QT_ON_ARM
#include "qdatetimeaxis.h"
#endif
+#include "shared_defines.h"
#include <QAbstractItemModel>
+#ifdef CHARTS_FOR_QUICK2
+#include <QtQml/QQmlExtensionPlugin>
+#else
#include <QtDeclarative/qdeclarativeextensionplugin.h>
#include <QtDeclarative/qdeclarative.h>
+#endif
QTCOMMERCIALCHART_USE_NAMESPACE
@@ -67,6 +72,7 @@ Q_DECLARE_METATYPE(DeclarativePolarChart *)
Q_DECLARE_METATYPE(DeclarativeMargins *)
Q_DECLARE_METATYPE(DeclarativeAreaSeries *)
Q_DECLARE_METATYPE(DeclarativeBarSeries *)
+Q_DECLARE_METATYPE(DeclarativeBarSet *)
Q_DECLARE_METATYPE(DeclarativeLineSeries *)
Q_DECLARE_METATYPE(DeclarativePieSeries *)
Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
@@ -116,12 +122,16 @@ Q_DECLARE_METATYPE(QStackedBarSeries *)
QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class ChartQmlPlugin : public QDeclarativeExtensionPlugin
+class ChartQmlPlugin : public QDECLARATIVE_EXTENSION_PLUGIN
{
Q_OBJECT
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
+#ifdef CHARTS_FOR_QUICK2
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+#else
+# if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDeclarativeExtensionInterface")
+# endif
#endif
public:
diff --git a/plugins/declarative/shared_defines.h b/plugins/declarative/shared_defines.h
new file mode 100644
index 00000000..f5580cfe
--- /dev/null
+++ b/plugins/declarative/shared_defines.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SHARED_DEFINES_H
+#define SHARED_DEFINES_H
+
+#ifdef CHARTS_FOR_QUICK2
+#define QDECLARATIVE_ITEM QQuickItem
+#define QDECLARATIVE_PAINTED_ITEM QQuickPaintedItem
+#define QDECLARATIVE_LIST_PROPERTY QQmlListProperty
+#define QDECLARATIVE_EXTENSION_PLUGIN QQmlExtensionPlugin
+#define QDECLARATIVE_PARSER_STATUS QQmlParserStatus
+#define LIST_PROPERTY_PARAM_DEFAULTS ,0,0,0
+
+#else
+#define QDECLARATIVE_ITEM QDeclarativeItem
+#define QDECLARATIVE_PAINTED_ITEM QDeclarativeItem
+#define QDECLARATIVE_LIST_PROPERTY QDeclarativeListProperty
+#define QDECLARATIVE_EXTENSION_PLUGIN QDeclarativeExtensionPlugin
+#define QDECLARATIVE_PARSER_STATUS QDeclarativeParserStatus
+#define LIST_PROPERTY_PARAM_DEFAULTS ,0,0
+
+#endif
+
+#endif // SHARED_DEFINES_H
diff --git a/plugins/plugins.pro b/plugins/plugins.pro
index e9cda3b0..704489d1 100644
--- a/plugins/plugins.pro
+++ b/plugins/plugins.pro
@@ -7,7 +7,10 @@ TEMPLATE = subdirs
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 {
- SUBDIRS += declarative
+ SUBDIRS += quick1
+ contains(QT_VERSION, ^5\\..*\\..*$) {
+ qtHaveModule(quick): SUBDIRS += quick2
+ }
}
!linux-arm*:!qnx:!vxworks:!wince*: {
diff --git a/plugins/declarative/qmldir b/plugins/quick1/qmldir
index d4b6ae7d..d4b6ae7d 100644
--- a/plugins/declarative/qmldir
+++ b/plugins/quick1/qmldir
diff --git a/plugins/quick1/quick1.pro b/plugins/quick1/quick1.pro
new file mode 100644
index 00000000..17300d5c
--- /dev/null
+++ b/plugins/quick1/quick1.pro
@@ -0,0 +1,8 @@
+TARGET = qtcommercialchartqml
+QT += declarative
+IMPORT_INSTALL_PATH = $$[QT_INSTALL_IMPORTS]
+
+!include(../declarative/declarative.pri) {
+ error( "Couldn't find the declarative.pri file!" )
+}
+
diff --git a/plugins/quick2/qmldir b/plugins/quick2/qmldir
new file mode 100644
index 00000000..90d4edb8
--- /dev/null
+++ b/plugins/quick2/qmldir
@@ -0,0 +1,2 @@
+module QtCommercial.Chart
+plugin qtcommercialchartqml2
diff --git a/plugins/quick2/quick2.pro b/plugins/quick2/quick2.pro
new file mode 100644
index 00000000..43f697db
--- /dev/null
+++ b/plugins/quick2/quick2.pro
@@ -0,0 +1,9 @@
+TARGET = qtcommercialchartqml2
+QT += quick qml widgets
+IMPORT_INSTALL_PATH = $$[QT_INSTALL_QML]
+DEFINES += CHARTS_FOR_QUICK2
+
+!include(../declarative/declarative.pri) {
+ error( "Couldn't find the declarative.pri file!" )
+}
+
diff --git a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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 fba2d52a..00000000
--- a/tests/qmlchartaxis/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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 fccb2d44..09353d70 100644
--- a/tests/qmlchartaxis/qmlchartaxis.pro
+++ b/tests/qmlchartaxis/qmlchartaxis.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../../demos/shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp b/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp
deleted file mode 100644
index 0f12265e..00000000
--- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// checksum 0xbd34 version 0x80016
-/*
- 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_QNX)
- 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 fba2d52a..00000000
--- a/tests/qmlchartproperties/qmlapplicationviewer/qmlapplicationviewer.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// checksum 0xc67a version 0x80016
-/*
- 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 fccb2d44..09353d70 100644
--- a/tests/qmlchartproperties/qmlchartproperties.pro
+++ b/tests/qmlchartproperties/qmlchartproperties.pro
@@ -5,4 +5,4 @@
RESOURCES += resources.qrc
SOURCES += main.cpp
-include(qmlapplicationviewer/qmlapplicationviewer.pri)
+include(../../demos/shared/qmlapplicationviewer/qmlapplicationviewer.pri)
diff --git a/tests/quick2chartproperties/main.cpp b/tests/quick2chartproperties/main.cpp
new file mode 100644
index 00000000..5fec3b82
--- /dev/null
+++ b/tests/quick2chartproperties/main.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtWidgets/QApplication>
+#include <QtQuick/QQuickItem>
+#include "qtquick2applicationviewer.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QtQuick2ApplicationViewer viewer;
+ 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
new file mode 100644
index 00000000..a4483388
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/AreaChart.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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 }
+ }
+
+ 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);
+ }
+
+ 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
new file mode 100644
index 00000000..5086980b
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/AreaEditor.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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 {
+ 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
new file mode 100644
index 00000000..ecda57b1
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/BarChart.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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"
+ 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);
+ 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);
+ onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
+ onCountChanged: console.log("barSeries.onCountChanged: " + count);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
new file mode 100644
index 00000000..de64f0a5
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/BarEditor.qml
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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: "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
new file mode 100644
index 00000000..433957f0
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/Button.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..2f8b4236
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.2
+
+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);
+ onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name);
+ onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name);
+
+ 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);
+ 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
new file mode 100644
index 00000000..4494df45
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditor.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..fcca537b
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorAxis.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..26695100
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorLegend.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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;
+ }
+ }
+
+ FontEditor {
+ fontDescription: "legend"
+ function editedFont() {
+ return chartLegend.font;
+ }
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml
new file mode 100644
index 00000000..f0e63a59
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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: "drop shadow enabled"
+ onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled;
+ }
+ Button {
+ text: "zoom +"
+ onClicked: chart.zoom(2);
+ }
+ Button {
+ text: "zoom -"
+ onClicked: chart.zoom(0.5);
+ }
+ Button {
+ text: "scroll left"
+ onClicked: chart.scrollLeft(10);
+ }
+ Button {
+ text: "scroll right"
+ onClicked: chart.scrollRight(10);
+ }
+ Button {
+ text: "scroll up"
+ onClicked: chart.scrollUp(10);
+ }
+ Button {
+ text: "scroll down"
+ onClicked: chart.scrollDown(10);
+ }
+ Button {
+ text: "title color"
+ onClicked: chart.titleColor = main.nextColor();
+ }
+ Button {
+ text: "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
new file mode 100644
index 00000000..a1c3538e
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorSeries.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..9d982aa1
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorTitle.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..4d7042f1
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/FontEditor.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..a7d59657
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalBarChart.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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"
+ 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);
+ 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);
+ onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
+ onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
new file mode 100644
index 00000000..05dae6dd
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalPercentBarChart.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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"
+ 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);
+ 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);
+ onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
+ onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
new file mode 100644
index 00000000..4f0b3930
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/HorizontalStackedBarChart.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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"
+ 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);
+ 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);
+ onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
+ onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
new file mode 100644
index 00000000..b2070cf6
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/LineChart.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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 }
+
+ 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);
+ }
+
+ 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);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
new file mode 100644
index 00000000..9669be1b
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/LineEditor.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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: "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(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1);
+ }
+ }
+ Button {
+ text: "remove point"
+ onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y);
+ }
+ 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
new file mode 100644
index 00000000..4e1c30f3
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/PercentBarChart.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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"
+ 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);
+ 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);
+ onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
+ onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml
new file mode 100644
index 00000000..85189fcb
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/PieChart.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..88e35926
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/PieEditor.qml
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..a360c74e
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterChart.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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 }
+
+ 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);
+ 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);
+ }
+
+ 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);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
new file mode 100644
index 00000000..2e9239c7
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/ScatterEditor.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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: "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(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1);
+ }
+ }
+ Button {
+ text: "remove point"
+ onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y);
+ }
+ 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
new file mode 100644
index 00000000..bbeccd99
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/SplineChart.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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 }
+
+ 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);
+ 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);
+ }
+
+ 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);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
new file mode 100644
index 00000000..2883d8a5
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/StackedBarChart.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtCommercial.Chart 1.1
+
+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"
+ 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);
+ 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);
+ onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
+ onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
+ }
+}
diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml b/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml
new file mode 100644
index 00000000..adbcd31c
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/loader.qml
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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
new file mode 100644
index 00000000..60d1e445
--- /dev/null
+++ b/tests/quick2chartproperties/qml/quick2chartproperties/main.qml
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc
+** All rights reserved.
+** For any questions to Digia, please use contact form at http://qt.digia.com
+**
+** This file is part of the Qt Commercial Charts Add-on.
+**
+** $QT_BEGIN_LICENSE$
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://qt.digia.com
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 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/quick2chartproperties.pro b/tests/quick2chartproperties/quick2chartproperties.pro
new file mode 100644
index 00000000..0f482f49
--- /dev/null
+++ b/tests/quick2chartproperties/quick2chartproperties.pro
@@ -0,0 +1,9 @@
+!include( ../tests.pri ) {
+ error( "Couldn't find the test.pri file!" )
+}
+
+RESOURCES += resources.qrc
+SOURCES += main.cpp
+OTHER_FILES += qml/quick2chartproperties/*
+
+include(../../demos/shared/qtquick2applicationviewer/qtquick2applicationviewer.pri)
diff --git a/tests/quick2chartproperties/resources.qrc b/tests/quick2chartproperties/resources.qrc
new file mode 100644
index 00000000..181ff6c0
--- /dev/null
+++ b/tests/quick2chartproperties/resources.qrc
@@ -0,0 +1,31 @@
+<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.pro b/tests/tests.pro
index f57bd3e0..73f45abe 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -17,3 +17,7 @@ contains(QT_CONFIG, opengl) {
} else {
message("OpenGL not available. Some test apps are disabled")
}
+
+contains(QT_VERSION, ^5\\..*\\..*$):qtHaveModule(quick) {
+ SUBDIRS += quick2chartproperties
+}