diff options
Diffstat (limited to 'src/charts')
-rw-r--r-- | src/charts/chartpresenter.cpp | 1 | ||||
-rw-r--r-- | src/charts/chartpresenter_p.h | 3 | ||||
-rw-r--r-- | src/charts/qchart.cpp | 11 | ||||
-rw-r--r-- | src/charts/qchart.h | 4 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/charts/chartpresenter.cpp b/src/charts/chartpresenter.cpp index 4eb0757c..f92fb5c5 100644 --- a/src/charts/chartpresenter.cpp +++ b/src/charts/chartpresenter.cpp @@ -67,6 +67,7 @@ void ChartPresenter::setGeometry(const QRectF rect) chart->domain()->setSize(rect.size()); chart->setPos(rect.topLeft()); } + emit plotAreaChanged(m_rect); } } diff --git a/src/charts/chartpresenter_p.h b/src/charts/chartpresenter_p.h index 238ae3f1..1c338b11 100644 --- a/src/charts/chartpresenter_p.h +++ b/src/charts/chartpresenter_p.h @@ -169,6 +169,9 @@ public Q_SLOTS: void handleAxisAdded(QAbstractAxis *axis); void handleAxisRemoved(QAbstractAxis *axis); +signals: + void plotAreaChanged(const QRectF &plotArea); + private: QChart *m_chart; QList<ChartItem *> m_chartItems; diff --git a/src/charts/qchart.cpp b/src/charts/qchart.cpp index 69584a82..a7f58941 100644 --- a/src/charts/qchart.cpp +++ b/src/charts/qchart.cpp @@ -169,6 +169,12 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! + \property QChart::plotArea + Holds the rectangle within which the drawing of the chart is done. + It does not include the area defined by margins. +*/ + +/*! \internal Constructs a chart object of \a type which is a child of a \a parent. Parameter \a wFlags is passed to the QGraphicsWidget constructor. @@ -526,10 +532,6 @@ QChart::ChartType QChart::chartType() const return d_ptr->m_type; } -/*! - Returns the the rectangle within which the drawing of the chart is done. - It does not include the area defined by margins. - */ QRectF QChart::plotArea() const { return d_ptr->m_presenter->geometry(); @@ -762,6 +764,7 @@ QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type): QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_themeManager, SLOT(handleSeriesRemoved(QAbstractSeries*))); QObject::connect(m_dataset, SIGNAL(axisAdded(QAbstractAxis*)), m_themeManager, SLOT(handleAxisAdded(QAbstractAxis*))); QObject::connect(m_dataset, SIGNAL(axisRemoved(QAbstractAxis*)), m_themeManager, SLOT(handleAxisRemoved(QAbstractAxis*))); + QObject::connect(m_presenter, &ChartPresenter::plotAreaChanged, q, &QChart::plotAreaChanged); } QChartPrivate::~QChartPrivate() diff --git a/src/charts/qchart.h b/src/charts/qchart.h index 40712c5d..d4d386d9 100644 --- a/src/charts/qchart.h +++ b/src/charts/qchart.h @@ -51,6 +51,7 @@ class QT_CHARTS_EXPORT QChart : public QGraphicsWidget Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers) Q_PROPERTY(QLocale locale READ locale WRITE setLocale) + Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged) Q_ENUMS(ChartTheme) Q_ENUMS(AnimationOption) Q_ENUMS(ChartType) @@ -163,6 +164,9 @@ public: ChartType chartType() const; +signals: + void plotAreaChanged(const QRectF &plotArea); + protected: explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags); QScopedPointer<QChartPrivate> d_ptr; |