summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorTitta Heikkala <titta.heikkala@digia.com>2014-04-14 07:20:54 +0300
committerTitta Heikkala <titta.heikkala@digia.com>2014-05-02 13:18:44 +0300
commit8344a0102a72f2fbdafe472bd88082866a495b51 (patch)
treef3de2d80b4791d0c988928d2ac1efb4e6cab0ac3 /plugins
parent743754a36d25c3f529603b1f404a131982c897f6 (diff)
Add possibility to set brush image via QML API
User can set a brush image for AreaSeries, BarSet, BoxPlotSeries, BoxSet, PieSlice and ScatterSeries by specifying 'brushFilename'. Task-number: QTRD-2603 Change-Id: Ie4b75cec1f64da513b1b85749c28984cb7f88e38 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/declarative/declarativeareaseries.cpp40
-rw-r--r--plugins/declarative/declarativeareaseries.h15
-rw-r--r--plugins/declarative/declarativebarseries.cpp29
-rw-r--r--plugins/declarative/declarativebarseries.h9
-rw-r--r--plugins/declarative/declarativeboxplotseries.cpp58
-rw-r--r--plugins/declarative/declarativeboxplotseries.h22
-rw-r--r--plugins/declarative/declarativepieseries.cpp45
-rw-r--r--plugins/declarative/declarativepieseries.h25
-rw-r--r--plugins/declarative/declarativescatterseries.cpp40
-rw-r--r--plugins/declarative/declarativescatterseries.h15
-rw-r--r--plugins/declarative/plugin.cpp9
-rw-r--r--plugins/quick2/plugins.qmltypes92
12 files changed, 370 insertions, 29 deletions
diff --git a/plugins/declarative/declarativeareaseries.cpp b/plugins/declarative/declarativeareaseries.cpp
index 94fbb13c..87c223d9 100644
--- a/plugins/declarative/declarativeareaseries.cpp
+++ b/plugins/declarative/declarativeareaseries.cpp
@@ -33,6 +33,7 @@ DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
}
void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
@@ -70,6 +71,45 @@ void DeclarativeAreaSeries::setBorderWidth(qreal width)
}
}
+QString DeclarativeAreaSeries::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeAreaSeries::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QAreaSeries::brush().textureImage() != brushImage) {
+ QBrush brush = QAreaSeries::brush();
+ brush.setTextureImage(brushImage);
+ QAreaSeries::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeAreaSeries::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QAreaSeries::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+void DeclarativeAreaSeries::setBrush(const QBrush &brush)
+{
+ QAreaSeries::setBrush(brush);
+ emit brushChanged();
+}
+
+QBrush DeclarativeAreaSeries::brush() const
+{
+ return QAreaSeries::brush();
+}
+
#include "moc_declarativeareaseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativeareaseries.h b/plugins/declarative/declarativeareaseries.h
index af1be0ea..3f37e7ba 100644
--- a/plugins/declarative/declarativeareaseries.h
+++ b/plugins/declarative/declarativeareaseries.h
@@ -39,6 +39,8 @@ class DeclarativeAreaSeries : public QAreaSeries
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)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
public:
explicit DeclarativeAreaSeries(QObject *parent = 0);
@@ -60,6 +62,10 @@ public:
Q_REVISION(3) void setAxisRadial(QAbstractAxis *axis) { m_axes->setAxisY(axis); }
qreal borderWidth() const;
void setBorderWidth(qreal borderWidth);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
Q_SIGNALS:
Q_REVISION(1) void axisXChanged(QAbstractAxis *axis);
@@ -69,9 +75,18 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
+ Q_REVISION(4) void brushChanged();
+ Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleBrushChanged();
public:
DeclarativeAxes *m_axes;
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
};
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativebarseries.cpp b/plugins/declarative/declarativebarseries.cpp
index 29cd26c7..45008ea8 100644
--- a/plugins/declarative/declarativebarseries.cpp
+++ b/plugins/declarative/declarativebarseries.cpp
@@ -30,6 +30,7 @@ DeclarativeBarSet::DeclarativeBarSet(QObject *parent)
{
connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
}
void DeclarativeBarSet::handleCountChanged(int index, int count)
@@ -97,6 +98,34 @@ void DeclarativeBarSet::setValues(QVariantList values)
}
}
+QString DeclarativeBarSet::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeBarSet::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QBarSet::brush().textureImage() != brushImage) {
+ QBrush brush = QBarSet::brush();
+ brush.setTextureImage(brushImage);
+ QBarSet::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeBarSet::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QBarSet::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
// Declarative bar series ======================================================================================
DeclarativeBarSeries::DeclarativeBarSeries(QDECLARATIVE_ITEM *parent) :
QBarSeries(parent),
diff --git a/plugins/declarative/declarativebarseries.h b/plugins/declarative/declarativebarseries.h
index 7c5856c6..b224e24c 100644
--- a/plugins/declarative/declarativebarseries.h
+++ b/plugins/declarative/declarativebarseries.h
@@ -49,6 +49,7 @@ class DeclarativeBarSet : public QBarSet
Q_PROPERTY(QVariantList values READ values WRITE setValues)
Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1)
Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 2)
public:
explicit DeclarativeBarSet(QObject *parent = 0);
@@ -56,6 +57,8 @@ public:
void setValues(QVariantList values);
qreal borderWidth() const;
void setBorderWidth(qreal borderWidth);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
public: // From QBarSet
Q_INVOKABLE void append(qreal value) { QBarSet::append(value); }
@@ -66,9 +69,15 @@ public: // From QBarSet
Q_SIGNALS:
void countChanged(int count);
Q_REVISION(1) void borderWidthChanged(qreal width);
+ Q_REVISION(2) void brushFilenameChanged(const QString &brushFilename);
private Q_SLOTS:
void handleCountChanged(int index, int count);
+ void handleBrushChanged();
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
};
class DeclarativeBarSeries : public QBarSeries, public QDECLARATIVE_PARSER_STATUS
diff --git a/plugins/declarative/declarativeboxplotseries.cpp b/plugins/declarative/declarativeboxplotseries.cpp
index 9ff3af7e..7cdcde6e 100644
--- a/plugins/declarative/declarativeboxplotseries.cpp
+++ b/plugins/declarative/declarativeboxplotseries.cpp
@@ -245,6 +245,7 @@ DeclarativeBoxSet::DeclarativeBoxSet(const QString label, QObject *parent)
{
connect(this, SIGNAL(valuesChanged()), this, SIGNAL(changedValues()));
connect(this, SIGNAL(valueChanged(int)), this, SIGNAL(changedValue(int)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
}
QVariantList DeclarativeBoxSet::values()
@@ -263,6 +264,34 @@ void DeclarativeBoxSet::setValues(QVariantList values)
}
}
+QString DeclarativeBoxSet::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeBoxSet::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QBoxSet::brush().textureImage() != brushImage) {
+ QBrush brush = QBoxSet::brush();
+ brush.setTextureImage(brushImage);
+ QBoxSet::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeBoxSet::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QBoxSet::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
// =====================================================
DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
@@ -275,6 +304,7 @@ DeclarativeBoxPlotSeries::DeclarativeBoxPlotSeries(QDECLARATIVE_ITEM *parent) :
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
connect(this, SIGNAL(hovered(bool, QBoxSet*)), this, SLOT(onHovered(bool, QBoxSet*)));
connect(this, SIGNAL(clicked(QBoxSet*)), this, SLOT(onClicked(QBoxSet*)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
}
void DeclarativeBoxPlotSeries::classBegin()
@@ -334,6 +364,34 @@ void DeclarativeBoxPlotSeries::onClicked(QBoxSet *boxset)
emit clicked(qobject_cast<DeclarativeBoxSet *>(boxset));
}
+QString DeclarativeBoxPlotSeries::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeBoxPlotSeries::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QBoxPlotSeries::brush().textureImage() != brushImage) {
+ QBrush brush = QBoxPlotSeries::brush();
+ brush.setTextureImage(brushImage);
+ QBoxPlotSeries::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeBoxPlotSeries::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QBoxPlotSeries::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
#include "moc_declarativeboxplotseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativeboxplotseries.h b/plugins/declarative/declarativeboxplotseries.h
index 3c6b4fdd..a8a7000a 100644
--- a/plugins/declarative/declarativeboxplotseries.h
+++ b/plugins/declarative/declarativeboxplotseries.h
@@ -40,6 +40,7 @@ class DeclarativeBoxSet : public QBoxSet
Q_PROPERTY(QVariantList values READ values WRITE setValues)
Q_PROPERTY(QString label READ label WRITE setLabel)
Q_PROPERTY(int count READ count)
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
Q_ENUMS(ValuePositions)
public: // duplicate from QBoxSet
@@ -55,6 +56,8 @@ public:
explicit DeclarativeBoxSet(const QString label = "", QObject *parent = 0);
QVariantList values();
void setValues(QVariantList values);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
public: // From QBoxSet
Q_INVOKABLE void append(qreal value) { QBoxSet::append(value); }
@@ -65,6 +68,14 @@ public: // From QBoxSet
Q_SIGNALS:
void changedValues();
void changedValue(int index);
+ Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
};
class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARSER_STATUS
@@ -84,6 +95,7 @@ class DeclarativeBoxPlotSeries : public QBoxPlotSeries, public QDECLARATIVE_PARS
#else
Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
#endif
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 1)
Q_CLASSINFO("DefaultProperty", "seriesChildren")
public:
@@ -97,6 +109,8 @@ public:
QAbstractAxis *axisYRight() { return m_axes->axisYRight(); }
void setAxisYRight(QAbstractAxis *axis) { m_axes->setAxisYRight(axis); }
QDECLARATIVE_LIST_PROPERTY<QObject> seriesChildren();
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
public:
Q_INVOKABLE DeclarativeBoxSet *at(int index);
@@ -117,14 +131,22 @@ Q_SIGNALS:
void axisYRightChanged(QAbstractAxis *axis);
void clicked(DeclarativeBoxSet *boxset);
void hovered(bool status, DeclarativeBoxSet *boxset);
+ Q_REVISION(1) void brushFilenameChanged(const QString &brushFilename);
public Q_SLOTS:
static void appendSeriesChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
void onHovered(bool status, QBoxSet *boxset);
void onClicked(QBoxSet *boxset);
+private Q_SLOTS:
+ void handleBrushChanged();
+
public:
DeclarativeAxes *m_axes;
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
};
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativepieseries.cpp b/plugins/declarative/declarativepieseries.cpp
index acceca8b..3ecfe349 100644
--- a/plugins/declarative/declarativepieseries.cpp
+++ b/plugins/declarative/declarativepieseries.cpp
@@ -25,6 +25,41 @@
QTCOMMERCIALCHART_BEGIN_NAMESPACE
+DeclarativePieSlice::DeclarativePieSlice(QObject *parent)
+ : QPieSlice(parent)
+{
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
+}
+
+QString DeclarativePieSlice::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativePieSlice::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QPieSlice::brush().textureImage() != brushImage) {
+ QBrush brush = QPieSlice::brush();
+ brush.setTextureImage(brushImage);
+ QPieSlice::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativePieSlice::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QPieSlice::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
+// Declarative pie series =========================================================================
DeclarativePieSeries::DeclarativePieSeries(QDECLARATIVE_ITEM *parent) :
QPieSeries(parent)
{
@@ -81,13 +116,15 @@ QPieSlice *DeclarativePieSeries::find(QString label)
return 0;
}
-QPieSlice *DeclarativePieSeries::append(QString label, qreal value)
+DeclarativePieSlice *DeclarativePieSeries::append(QString label, qreal value)
{
- QPieSlice *slice = new QPieSlice(this);
+ DeclarativePieSlice *slice = new DeclarativePieSlice(this);
slice->setLabel(label);
slice->setValue(value);
- QPieSeries::append(slice);
- return slice;
+ if (QPieSeries::append(slice))
+ return slice;
+ delete slice;
+ return 0;
}
bool DeclarativePieSeries::remove(QPieSlice *slice)
diff --git a/plugins/declarative/declarativepieseries.h b/plugins/declarative/declarativepieseries.h
index 5f4ec0e1..12cb1810 100644
--- a/plugins/declarative/declarativepieseries.h
+++ b/plugins/declarative/declarativepieseries.h
@@ -22,6 +22,7 @@
#define DECLARATIVEPIESERIES_H
#include "qpieseries.h"
+#include "qpieslice.h"
#include "shared_defines.h"
#ifdef CHARTS_FOR_QUICK2
@@ -33,7 +34,27 @@
#endif
QTCOMMERCIALCHART_BEGIN_NAMESPACE
-class QPieSlice;
+
+class DeclarativePieSlice : public QPieSlice
+{
+ Q_OBJECT
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged)
+
+public:
+ explicit DeclarativePieSlice(QObject *parent = 0);
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+
+Q_SIGNALS:
+ void brushFilenameChanged(const QString &brushFilename);
+
+private Q_SLOTS:
+ void handleBrushChanged();
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
+};
class DeclarativePieSeries : public QPieSeries, public QDECLARATIVE_PARSER_STATUS
{
@@ -52,7 +73,7 @@ public:
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);
+ Q_INVOKABLE DeclarativePieSlice *append(QString label, qreal value);
Q_INVOKABLE bool remove(QPieSlice *slice);
Q_INVOKABLE void clear();
diff --git a/plugins/declarative/declarativescatterseries.cpp b/plugins/declarative/declarativescatterseries.cpp
index 8422556b..89e3c36d 100644
--- a/plugins/declarative/declarativescatterseries.cpp
+++ b/plugins/declarative/declarativescatterseries.cpp
@@ -34,6 +34,7 @@ DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) :
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int)));
connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int)));
+ connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
}
void DeclarativeScatterSeries::handleCountChanged(int index)
@@ -69,6 +70,45 @@ void DeclarativeScatterSeries::appendDeclarativeChildren(QDECLARATIVE_LIST_PROPE
// Empty implementation, children are parsed in componentComplete
}
+QString DeclarativeScatterSeries::brushFilename() const
+{
+ return m_brushFilename;
+}
+
+void DeclarativeScatterSeries::setBrushFilename(const QString &brushFilename)
+{
+ QImage brushImage(brushFilename);
+ if (QScatterSeries::brush().textureImage() != brushImage) {
+ QBrush brush = QScatterSeries::brush();
+ brush.setTextureImage(brushImage);
+ QScatterSeries::setBrush(brush);
+ m_brushFilename = brushFilename;
+ m_brushImage = brushImage;
+ emit brushFilenameChanged(brushFilename);
+ }
+}
+
+void DeclarativeScatterSeries::setBrush(const QBrush &brush)
+{
+ QScatterSeries::setBrush(brush);
+ emit brushChanged();
+}
+
+QBrush DeclarativeScatterSeries::brush() const
+{
+ return QScatterSeries::brush();
+}
+
+void DeclarativeScatterSeries::handleBrushChanged()
+{
+ // If the texture image of the brush has changed along the brush
+ // the brush file name needs to be cleared.
+ if (!m_brushFilename.isEmpty() && QScatterSeries::brush().textureImage() != m_brushImage) {
+ m_brushFilename.clear();
+ emit brushFilenameChanged(QString(""));
+ }
+}
+
#include "moc_declarativescatterseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/declarativescatterseries.h b/plugins/declarative/declarativescatterseries.h
index c59e0e95..17e95e44 100644
--- a/plugins/declarative/declarativescatterseries.h
+++ b/plugins/declarative/declarativescatterseries.h
@@ -57,6 +57,8 @@ class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeri
#else
Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren)
#endif
+ Q_PROPERTY(QString brushFilename READ brushFilename WRITE setBrushFilename NOTIFY brushFilenameChanged REVISION 4)
+ Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged REVISION 4)
Q_CLASSINFO("DefaultProperty", "declarativeChildren")
public:
@@ -77,6 +79,10 @@ public:
qreal borderWidth() const;
void setBorderWidth(qreal borderWidth);
QDECLARATIVE_LIST_PROPERTY<QObject> declarativeChildren();
+ QString brushFilename() const;
+ void setBrushFilename(const QString &brushFilename);
+ void setBrush(const QBrush &brush);
+ QBrush brush() const;
public: // from QDeclarativeParserStatus
void classBegin() { DeclarativeXySeries::classBegin(); }
@@ -101,13 +107,22 @@ Q_SIGNALS:
Q_REVISION(2) void axisYRightChanged(QAbstractAxis *axis);
Q_REVISION(3) void axisAngularChanged(QAbstractAxis *axis);
Q_REVISION(3) void axisRadialChanged(QAbstractAxis *axis);
+ Q_REVISION(4) void brushFilenameChanged(const QString &brushFilename);
+ Q_REVISION(4) void brushChanged();
public Q_SLOTS:
static void appendDeclarativeChildren(QDECLARATIVE_LIST_PROPERTY<QObject> *list, QObject *element);
void handleCountChanged(int index);
+private Q_SLOTS:
+ void handleBrushChanged();
+
public:
DeclarativeAxes *m_axes;
+
+private:
+ QString m_brushFilename;
+ QImage m_brushImage;
};
QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp
index 01de104a..ad4aca7e 100644
--- a/plugins/declarative/plugin.cpp
+++ b/plugins/declarative/plugin.cpp
@@ -76,6 +76,7 @@ Q_DECLARE_METATYPE(DeclarativeBoxPlotSeries *)
Q_DECLARE_METATYPE(DeclarativeBoxSet *)
Q_DECLARE_METATYPE(DeclarativeLineSeries *)
Q_DECLARE_METATYPE(DeclarativePieSeries *)
+Q_DECLARE_METATYPE(DeclarativePieSlice *)
Q_DECLARE_METATYPE(DeclarativeScatterSeries *)
Q_DECLARE_METATYPE(DeclarativeSplineSeries *)
@@ -238,6 +239,14 @@ public:
qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
+
+ // QtCommercial.Chart 1.4
+ qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries");
+ qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet");
+ qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries");
+ qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet");
+ qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice");
+ qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries");
}
};
diff --git a/plugins/quick2/plugins.qmltypes b/plugins/quick2/plugins.qmltypes
index 8f715cb1..d0a9bd62 100644
--- a/plugins/quick2/plugins.qmltypes
+++ b/plugins/quick2/plugins.qmltypes
@@ -2,6 +2,9 @@ import QtQuick.tooling 1.1
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtCommercial.Chart 1.4'
Module {
Component {
@@ -55,9 +58,10 @@ Module {
"QtCommercial.Chart/AreaSeries 1.0",
"QtCommercial.Chart/AreaSeries 1.1",
"QtCommercial.Chart/AreaSeries 1.2",
- "QtCommercial.Chart/AreaSeries 1.3"
+ "QtCommercial.Chart/AreaSeries 1.3",
+ "QtCommercial.Chart/AreaSeries 1.4"
]
- exportMetaObjectRevisions: [0, 1, 2, 3]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4]
Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
@@ -67,6 +71,8 @@ Module {
Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
Property { name: "borderWidth"; revision: 1; type: "double" }
+ Property { name: "brushFilename"; revision: 4; type: "string" }
+ Property { name: "brush"; revision: 4; type: "QBrush" }
Signal {
name: "axisXChanged"
revision: 1
@@ -102,12 +108,17 @@ Module {
revision: 3
Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
}
+ Signal { name: "brushChanged"; revision: 4 }
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 4
+ Parameter { name: "brushFilename"; type: "string" }
+ }
}
Component {
name: "QtCommercialChart::DeclarativeAxes"
prototype: "QObject"
exports: ["QtCommercial.Chart/DeclarativeAxes 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
@@ -200,12 +211,14 @@ Module {
prototype: "QtCommercialChart::QBarSet"
exports: [
"QtCommercial.Chart/BarSet 1.0",
- "QtCommercial.Chart/BarSet 1.1"
+ "QtCommercial.Chart/BarSet 1.1",
+ "QtCommercial.Chart/BarSet 1.4"
]
- exportMetaObjectRevisions: [0, 0]
+ exportMetaObjectRevisions: [0, 0, 2]
Property { name: "values"; type: "QVariantList" }
Property { name: "borderWidth"; revision: 1; type: "double" }
Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "brushFilename"; revision: 2; type: "string" }
Signal {
name: "countChanged"
Parameter { name: "count"; type: "int" }
@@ -215,6 +228,11 @@ Module {
revision: 1
Parameter { name: "width"; type: "double" }
}
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 2
+ Parameter { name: "brushFilename"; type: "string" }
+ }
Method {
name: "append"
Parameter { name: "value"; type: "double" }
@@ -243,13 +261,17 @@ Module {
name: "QtCommercialChart::DeclarativeBoxPlotSeries"
defaultProperty: "seriesChildren"
prototype: "QtCommercialChart::QBoxPlotSeries"
- exports: ["QtCommercial.Chart/BoxPlotSeries 1.3"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtCommercial.Chart/BoxPlotSeries 1.3",
+ "QtCommercial.Chart/BoxPlotSeries 1.4"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "brushFilename"; revision: 1; type: "string" }
Signal {
name: "axisXChanged"
Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
@@ -275,6 +297,11 @@ Module {
Parameter { name: "status"; type: "bool" }
Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
}
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 1
+ Parameter { name: "brushFilename"; type: "string" }
+ }
Method {
name: "appendSeriesChildren"
Parameter { name: "list"; type: "QDECLARATIVE_LIST_PROPERTY<QObject>"; isPointer: true }
@@ -321,8 +348,11 @@ Module {
Component {
name: "QtCommercialChart::DeclarativeBoxSet"
prototype: "QtCommercialChart::QBoxSet"
- exports: ["QtCommercial.Chart/BoxSet 1.3"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtCommercial.Chart/BoxSet 1.3",
+ "QtCommercial.Chart/BoxSet 1.4"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "ValuePositions"
values: {
@@ -336,11 +366,17 @@ Module {
Property { name: "values"; type: "QVariantList" }
Property { name: "label"; type: "string" }
Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "brushFilename"; revision: 1; type: "string" }
Signal { name: "changedValues" }
Signal {
name: "changedValue"
Parameter { name: "index"; type: "int" }
}
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 1
+ Parameter { name: "brushFilename"; type: "string" }
+ }
Method {
name: "append"
Parameter { name: "value"; type: "double" }
@@ -912,7 +948,6 @@ Module {
name: "QtCommercialChart::DeclarativeMargins"
prototype: "QObject"
exports: ["QtCommercial.Chart/Margins 1.1"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "top"; type: "int" }
Property { name: "bottom"; type: "int" }
@@ -1055,7 +1090,7 @@ Module {
}
Method {
name: "append"
- type: "QPieSlice*"
+ type: "DeclarativePieSlice*"
Parameter { name: "label"; type: "string" }
Parameter { name: "value"; type: "double" }
}
@@ -1067,6 +1102,17 @@ Module {
Method { name: "clear" }
}
Component {
+ name: "QtCommercialChart::DeclarativePieSlice"
+ prototype: "QtCommercialChart::QPieSlice"
+ exports: ["QtCommercial.Chart/PieSlice 1.4"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "brushFilename"; type: "string" }
+ Signal {
+ name: "brushFilenameChanged"
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ }
+ Component {
name: "QtCommercialChart::DeclarativePolarChart"
defaultProperty: "data"
prototype: "QtCommercialChart::DeclarativeChart"
@@ -1081,9 +1127,10 @@ Module {
"QtCommercial.Chart/ScatterSeries 1.0",
"QtCommercial.Chart/ScatterSeries 1.1",
"QtCommercial.Chart/ScatterSeries 1.2",
- "QtCommercial.Chart/ScatterSeries 1.3"
+ "QtCommercial.Chart/ScatterSeries 1.3",
+ "QtCommercial.Chart/ScatterSeries 1.4"
]
- exportMetaObjectRevisions: [0, 1, 2, 3]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
@@ -1093,6 +1140,8 @@ Module {
Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
Property { name: "borderWidth"; revision: 1; type: "double" }
Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "brushFilename"; revision: 4; type: "string" }
+ Property { name: "brush"; revision: 4; type: "QBrush" }
Signal {
name: "countChanged"
Parameter { name: "count"; type: "int" }
@@ -1132,6 +1181,12 @@ Module {
revision: 3
Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
}
+ Signal {
+ name: "brushFilenameChanged"
+ revision: 4
+ Parameter { name: "brushFilename"; type: "string" }
+ }
+ Signal { name: "brushChanged"; revision: 4 }
Method {
name: "appendDeclarativeChildren"
Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
@@ -1387,7 +1442,6 @@ Module {
name: "QtCommercialChart::QAbstractAxis"
prototype: "QObject"
exports: ["QtCommercial.Chart/AbstractAxis 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "visible"; type: "bool" }
Property { name: "lineVisible"; type: "bool" }
@@ -1506,7 +1560,6 @@ Module {
name: "QtCommercialChart::QAbstractBarSeries"
prototype: "QtCommercialChart::QAbstractSeries"
exports: ["QtCommercial.Chart/AbstractBarSeries 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "barWidth"; type: "double" }
Property { name: "count"; type: "int"; isReadonly: true }
@@ -1540,7 +1593,6 @@ Module {
name: "QtCommercialChart::QAbstractSeries"
prototype: "QObject"
exports: ["QtCommercial.Chart/AbstractSeries 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Enum {
name: "SeriesType"
@@ -1620,7 +1672,6 @@ Module {
name: "QtCommercialChart::QBarModelMapper"
prototype: "QObject"
exports: ["QtCommercial.Chart/BarModelMapper 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
}
Component {
@@ -1631,7 +1682,6 @@ Module {
name: "QtCommercialChart::QBarSet"
prototype: "QObject"
exports: ["QtCommercial.Chart/BarSetBase 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "label"; type: "string" }
Property { name: "pen"; type: "QPen" }
@@ -1823,7 +1873,6 @@ Module {
defaultProperty: "children"
prototype: "QGraphicsWidget"
exports: ["QtCommercial.Chart/Legend 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "alignment"; type: "Qt::Alignment" }
Property { name: "backgroundVisible"; type: "bool" }
@@ -1897,14 +1946,12 @@ Module {
name: "QtCommercialChart::QPieModelMapper"
prototype: "QObject"
exports: ["QtCommercial.Chart/PieModelMapper 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
}
Component {
name: "QtCommercialChart::QPieSeries"
prototype: "QtCommercialChart::QAbstractSeries"
exports: ["QtCommercial.Chart/QPieSeries 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "horizontalPosition"; type: "double" }
Property { name: "verticalPosition"; type: "double" }
@@ -1984,6 +2031,7 @@ Module {
Property { name: "borderColor"; type: "QColor" }
Property { name: "markerShape"; type: "MarkerShape" }
Property { name: "markerSize"; type: "double" }
+ Property { name: "brush"; type: "QBrush" }
Signal {
name: "colorChanged"
Parameter { name: "color"; type: "QColor" }
@@ -2083,14 +2131,12 @@ Module {
name: "QtCommercialChart::QXYModelMapper"
prototype: "QObject"
exports: ["QtCommercial.Chart/XYModelMapper 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
}
Component {
name: "QtCommercialChart::QXYSeries"
prototype: "QtCommercialChart::QAbstractSeries"
exports: ["QtCommercial.Chart/XYSeries 1.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "pointsVisible"; type: "bool" }
Property { name: "color"; type: "QColor" }