diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-04-18 13:30:07 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-04-23 09:24:32 +0300 |
commit | 5862599d088d072b4ac89ed556a645680f786d80 (patch) | |
tree | 838db883bea99b520ae90c634746f9f942fb6832 /plugins/declarative/declarativecategoryaxis.h | |
parent | b0caebd0eeccca1b5e901faa6e5df1a1f6301312 (diff) |
Generate charts plugin for QtQuick2 as well as QtQuick1
Added quick2 versions of a couple of demos, too.
Task-number: QTRD-1922
Change-Id: Ie3e2c1c40c38e06fc6d3afe27289eccc2f997f67
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'plugins/declarative/declarativecategoryaxis.h')
-rw-r--r-- | plugins/declarative/declarativecategoryaxis.h | 18 |
1 files changed, 15 insertions, 3 deletions
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); |