summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorTero Ahola <tero.ahola@digia.com>2012-08-31 13:22:50 +0300
committerTero Ahola <tero.ahola@digia.com>2012-08-31 13:22:50 +0300
commit0db37e179fcd315b4e5d038b7b606c0f13471088 (patch)
tree61dc0997c03a1333c9c95ad4ce6967b7c6974021 /plugins
parent6a089ea6fc66056de7b8ab9f8de4662a8ea9b376 (diff)
Added ChartView.plotArea to QML API
Diffstat (limited to 'plugins')
-rw-r--r--plugins/declarative/declarativechart.cpp14
-rw-r--r--plugins/declarative/declarativechart.h3
2 files changed, 16 insertions, 1 deletions
diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp
index 938a966b..09199f23 100644
--- a/plugins/declarative/declarativechart.cpp
+++ b/plugins/declarative/declarativechart.cpp
@@ -138,7 +138,18 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
/*!
\qmlproperty Margins ChartView::minimumMargins
- The minimum margins allowed between the outer bounds and the plotArea of the ChartView.
+ The minimum margins allowed between the outer bounds and the plotArea of the ChartView. Margins
+ area of ChartView is used for drawing title, axes and legend. Please note that setting the
+ properties of minimumMargins may be bigger than the defined value, depending on other ChartView
+ properties that affect it's layout. If you need to know the actual plotting area used at any
+ given time, you can check ChartView::plotArea instead.
+*/
+
+/*!
+ \qmlproperty rect ChartView::plotArea
+ The area on the ChartView that is used for drawing series. This is the ChartView rect without the
+ margins.
+ \sa ChartView::minimumMargins
*/
/*!
@@ -236,6 +247,7 @@ DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
void DeclarativeChart::changeMinimumMargins(int top, int bottom, int left, int right)
{
m_chart->setMinimumMargins(QMargins(left, top, right, bottom));
+ plotAreaChanged(m_chart->plotArea());
}
DeclarativeChart::~DeclarativeChart()
diff --git a/plugins/declarative/declarativechart.h b/plugins/declarative/declarativechart.h
index 74d9ca92..5733267b 100644
--- a/plugins/declarative/declarativechart.h
+++ b/plugins/declarative/declarativechart.h
@@ -46,6 +46,7 @@ class DeclarativeChart : public QDeclarativeItem
Q_PROPERTY(qreal leftMargin READ leftMargin NOTIFY leftMarginChanged)
Q_PROPERTY(qreal rightMargin READ rightMargin NOTIFY rightMarginChanged)
Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins REVISION 1)
+ Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1)
Q_ENUMS(Animation)
Q_ENUMS(Theme)
Q_ENUMS(SeriesType)
@@ -115,6 +116,7 @@ public:
qreal rightMargin();
void createDefaultAxes(QAbstractSeries* series);
DeclarativeMargins *minimumMargins() { return m_minMargins; }
+ QRectF plotArea() { return m_chart->plotArea(); }
public:
Q_INVOKABLE QAbstractSeries *series(int index);
@@ -141,6 +143,7 @@ Q_SIGNALS:
void bottomMarginChanged(qreal margin);
void leftMarginChanged(qreal margin);
void rightMarginChanged(qreal margin);
+ void plotAreaChanged(QRectF plotArea);
public Q_SLOTS:
// void handleMarginsChanged(QRectF newMargins);