summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/declarative/declarativechart.cpp24
-rw-r--r--plugins/declarative/declarativechart.h4
-rw-r--r--plugins/declarative/plugin.cpp1
3 files changed, 29 insertions, 0 deletions
diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp
index 9d3fcd0e..2d2c9528 100644
--- a/plugins/declarative/declarativechart.cpp
+++ b/plugins/declarative/declarativechart.cpp
@@ -112,6 +112,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
*/
/*!
+ \qmlproperty color ChartView::plotAreaColor
+ The color of the background of the chart's plot area. By default plot area background uses chart's
+ background color.
+ \sa ChartView::backgroundColor
+*/
+
+/*!
\qmlproperty bool ChartView::dropShadowEnabled
The chart's border drop shadow. Set to true to enable drop shadow.
*/
@@ -596,6 +603,23 @@ QColor DeclarativeChart::backgroundColor()
return m_chart->backgroundBrush().color();
}
+void QtCommercialChart::DeclarativeChart::setPlotAreaColor(QColor color)
+{
+ QBrush b = m_chart->plotAreaBackgroundBrush();
+ if (b.style() != Qt::SolidPattern || color != b.color()) {
+ b.setStyle(Qt::SolidPattern);
+ b.setColor(color);
+ m_chart->setPlotAreaBackgroundBrush(b);
+ m_chart->setPlotAreaBackgroundVisible(true);
+ emit plotAreaColorChanged();
+ }
+}
+
+QColor QtCommercialChart::DeclarativeChart::plotAreaColor()
+{
+ return m_chart->plotAreaBackgroundBrush().color();
+}
+
int DeclarativeChart::count()
{
return m_chart->series().count();
diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h
index 9fa45546..f0e24cb7 100644
--- a/plugins/declarative/declarativechart.h
+++ b/plugins/declarative/declarativechart.h
@@ -59,6 +59,7 @@ class DeclarativeChart : public QDECLARATIVE_PAINTED_ITEM
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)
+ Q_PROPERTY(QColor plotAreaColor READ plotAreaColor WRITE setPlotAreaColor NOTIFY plotAreaColorChanged REVISION 3)
#ifdef CHARTS_FOR_QUICK2
Q_PROPERTY(QQmlListProperty<QAbstractAxis> axes READ axes REVISION 2)
#else
@@ -133,6 +134,8 @@ public:
QColor titleColor();
void setBackgroundColor(QColor color);
QColor backgroundColor();
+ Q_REVISION(3) void setPlotAreaColor(QColor color);
+ Q_REVISION(3) QColor plotAreaColor();
int count();
void setDropShadowEnabled(bool enabled);
bool dropShadowEnabled();
@@ -183,6 +186,7 @@ Q_SIGNALS:
void plotAreaChanged(QRectF plotArea);
void seriesAdded(QAbstractSeries *series);
void seriesRemoved(QAbstractSeries *series);
+ Q_REVISION(3) void plotAreaColorChanged();
private Q_SLOTS:
void changeMinimumMargins(int top, int bottom, int left, int right);
diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp
index 0b3a59f6..029e6df9 100644
--- a/plugins/declarative/plugin.cpp
+++ b/plugins/declarative/plugin.cpp
@@ -229,6 +229,7 @@ public:
qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries");
// QtCommercial.Chart 1.3
+ qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView");
qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView");
qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries");
qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries");