From e824058bc1926a656736fa2490cb892ea9a4e2f5 2013-05-07 05:43:12 From: Miikka Heikkinen Date: 2013-05-07 05:43:12 Subject: [PATCH] Add API to specify plot area background. Task-number: http://jira.sc.local/browse/QTRD-1886 Change-Id: Ica9bd72482fdca14a81574087ba0ec4614169cd2 Reviewed-by: Tomi Korpipää --- diff --git a/plugins/declarative/declarativechart.cpp b/plugins/declarative/declarativechart.cpp index 9d3fcd0..2d2c952 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 9fa4554..f0e24cb 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 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 0b3a59f..029e6df 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -229,6 +229,7 @@ public: qmlRegisterType(uri, 1, 2, "HorizontalPercentBarSeries"); // QtCommercial.Chart 1.3 + qmlRegisterType(uri, 1, 3, "ChartView"); qmlRegisterType(uri, 1, 3, "PolarChartView"); qmlRegisterType(uri, 1, 3, "SplineSeries"); qmlRegisterType(uri, 1, 3, "ScatterSeries"); diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index f8242aa..83aa8f7 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -42,6 +42,7 @@ ChartPresenter::ChartPresenter(QChart *chart, QChart::ChartType type) m_options(QChart::NoAnimation), m_state(ShowState), m_background(0), + m_plotAreaBackground(0), m_title(0) { if (type == QChart::ChartTypeCartesian) @@ -156,6 +157,22 @@ void ChartPresenter::createBackgroundItem() } } +void ChartPresenter::createPlotAreaBackgroundItem() +{ + if (!m_plotAreaBackground) { + if (m_chart->chartType() == QChart::ChartTypeCartesian) + m_plotAreaBackground = new QGraphicsRectItem(rootItem()); + else + m_plotAreaBackground = new QGraphicsEllipseItem(rootItem()); + // Use transparent pen instead of Qt::NoPen, as Qt::NoPen causes + // antialising artifacts with axis lines for some reason. + m_plotAreaBackground->setPen(QPen(Qt::transparent)); + m_plotAreaBackground->setBrush(Qt::NoBrush); + m_plotAreaBackground->setZValue(ChartPresenter::PlotAreaZValue); + m_plotAreaBackground->setVisible(false); + } +} + void ChartPresenter::createTitleItem() { if (!m_title) { @@ -209,6 +226,34 @@ QPen ChartPresenter::backgroundPen() const return m_background->pen(); } +void ChartPresenter::setPlotAreaBackgroundBrush(const QBrush &brush) +{ + createPlotAreaBackgroundItem(); + m_plotAreaBackground->setBrush(brush); + m_layout->invalidate(); +} + +QBrush ChartPresenter::plotAreaBackgroundBrush() const +{ + if (!m_plotAreaBackground) + return QBrush(); + return m_plotAreaBackground->brush(); +} + +void ChartPresenter::setPlotAreaBackgroundPen(const QPen &pen) +{ + createPlotAreaBackgroundItem(); + m_plotAreaBackground->setPen(pen); + m_layout->invalidate(); +} + +QPen ChartPresenter::plotAreaBackgroundPen() const +{ + if (!m_plotAreaBackground) + return QPen(); + return m_plotAreaBackground->pen(); +} + void ChartPresenter::setTitle(const QString &title) { createTitleItem(); @@ -265,6 +310,19 @@ bool ChartPresenter::isBackgroundVisible() const return m_background->isVisible(); } +void ChartPresenter::setPlotAreaBackgroundVisible(bool visible) +{ + createPlotAreaBackgroundItem(); + m_plotAreaBackground->setVisible(visible); +} + +bool ChartPresenter::isPlotAreaBackgroundVisible() const +{ + if (!m_plotAreaBackground) + return false; + return m_plotAreaBackground->isVisible(); +} + void ChartPresenter::setBackgroundDropShadowEnabled(bool enabled) { createBackgroundItem(); @@ -299,6 +357,11 @@ ChartBackground *ChartPresenter::backgroundElement() return m_background; } +QAbstractGraphicsShapeItem *ChartPresenter::plotAreaElement() +{ + return m_plotAreaBackground; +} + QList ChartPresenter::axisItems() const { return m_axisItems; diff --git a/src/chartpresenter_p.h b/src/chartpresenter_p.h index 19bc5c4..dd36be9 100644 --- a/src/chartpresenter_p.h +++ b/src/chartpresenter_p.h @@ -55,7 +55,8 @@ class ChartPresenter: public QObject public: enum ZValues { BackgroundZValue = -1, - ShadesZValue , + PlotAreaZValue, + ShadesZValue, GridZValue, AxisZValue, SeriesZValue, @@ -87,6 +88,7 @@ public: QGraphicsItem *rootItem(){ return m_chart; } ChartBackground *backgroundElement(); + QAbstractGraphicsShapeItem *plotAreaElement(); ChartTitle *titleElement(); QList axisItems() const; QList chartItems() const; @@ -99,6 +101,12 @@ public: void setBackgroundPen(const QPen &pen); QPen backgroundPen() const; + void setPlotAreaBackgroundBrush(const QBrush &brush); + QBrush plotAreaBackgroundBrush() const; + + void setPlotAreaBackgroundPen(const QPen &pen); + QPen plotAreaBackgroundPen() const; + void setTitle(const QString &title); QString title() const; @@ -111,6 +119,9 @@ public: void setBackgroundVisible(bool visible); bool isBackgroundVisible() const; + void setPlotAreaBackgroundVisible(bool visible); + bool isPlotAreaBackgroundVisible() const; + void setBackgroundDropShadowEnabled(bool enabled); bool isBackgroundDropShadowEnabled() const; @@ -128,9 +139,11 @@ public: AbstractChartLayout *layout(); QChart::ChartType chartType() const { return m_chart->chartType(); } + QChart *chart() { return m_chart; } private: void createBackgroundItem(); + void createPlotAreaBackgroundItem(); void createTitleItem(); public Q_SLOTS: @@ -157,6 +170,7 @@ private: QList m_animations; AbstractChartLayout *m_layout; ChartBackground *m_background; + QAbstractGraphicsShapeItem *m_plotAreaBackground; ChartTitle *m_title; QRectF m_rect; }; diff --git a/src/chartthememanager.cpp b/src/chartthememanager.cpp index 0e4e4fa..68ac0e0 100644 --- a/src/chartthememanager.cpp +++ b/src/chartthememanager.cpp @@ -92,6 +92,14 @@ void ChartThemeManager::decorateChart(QChart *chart,ChartTheme* theme,bool force if (force || brush == chart->backgroundBrush()) chart->setBackgroundBrush(theme->chartBackgroundGradient()); + if (force) { + // Always clear plotArea brush when forced update, do not touch otherwise + QPen pen(Qt::transparent); + chart->setPlotAreaBackgroundBrush(brush); + chart->setPlotAreaBackgroundPen(pen); + chart->setPlotAreaBackgroundVisible(false); + } + chart->setTitleFont(theme->masterFont()); chart->setTitleBrush(theme->labelBrush()); chart->setDropShadowEnabled(theme->isBackgroundDropShadowEnabled()); diff --git a/src/layout/abstractchartlayout.cpp b/src/layout/abstractchartlayout.cpp index 092e8c0..4d05d23 100644 --- a/src/layout/abstractchartlayout.cpp +++ b/src/layout/abstractchartlayout.cpp @@ -64,6 +64,10 @@ void AbstractChartLayout::setGeometry(const QRectF &rect) contentGeometry = calculateAxisGeometry(contentGeometry, axes); m_presenter->setGeometry(contentGeometry); + if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) + static_cast(m_presenter->plotAreaElement())->setRect(contentGeometry); + else + static_cast(m_presenter->plotAreaElement())->setRect(contentGeometry); QGraphicsLayout::setGeometry(rect); } diff --git a/src/qchart.cpp b/src/qchart.cpp index 43414eb..f5740af 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -87,7 +87,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! \property QChart::backgroundVisible Specifies whether the chart background is visible or not. - \sa setBackgroundBrush(), setBackgroundPen() + \sa setBackgroundBrush(), setBackgroundPen(), plotAreaBackgroundVisible */ /*! @@ -130,6 +130,14 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \property QChart::plotAreaBackgroundVisible + Specifies whether the chart plot area background is visible or not. + \note By default the plot area background is not visible and the plot area uses + the general chart background. + \sa setPlotAreaBackgroundBrush(), setPlotAreaBackgroundPen(), backgroundVisible + */ + +/*! \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. @@ -476,6 +484,56 @@ QRectF QChart::plotArea() const return d_ptr->m_presenter->geometry(); } +/*! + Sets the \a brush for the background of the plot area of the chart. + + \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundPen(), plotAreaBackgroundBrush() + */ +void QChart::setPlotAreaBackgroundBrush(const QBrush &brush) +{ + d_ptr->m_presenter->setPlotAreaBackgroundBrush(brush); +} + +/*! + Returns the brush for the background of the plot area of the chart. + + \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundPen(), setPlotAreaBackgroundBrush() + */ +QBrush QChart::plotAreaBackgroundBrush() const +{ + return d_ptr->m_presenter->plotAreaBackgroundBrush(); +} + +/*! + Sets the \a pen for the background of the plot area of the chart. + + \sa plotArea(), plotAreaBackgroundVisible, setPlotAreaBackgroundBrush(), plotAreaBackgroundPen() + */ +void QChart::setPlotAreaBackgroundPen(const QPen &pen) +{ + d_ptr->m_presenter->setPlotAreaBackgroundPen(pen); +} + +/*! + Returns the \a pen for the background of the plot area of the chart. + + \sa plotArea(), plotAreaBackgroundVisible, plotAreaBackgroundBrush(), setPlotAreaBackgroundPen() + */ +QPen QChart::plotAreaBackgroundPen() const +{ + return d_ptr->m_presenter->plotAreaBackgroundPen(); +} + +void QChart::setPlotAreaBackgroundVisible(bool visible) +{ + d_ptr->m_presenter->setPlotAreaBackgroundVisible(visible); +} + +bool QChart::isPlotAreaBackgroundVisible() const +{ + return d_ptr->m_presenter->isPlotAreaBackgroundVisible(); +} + void QChart::setAnimationOptions(AnimationOptions options) { d_ptr->m_presenter->setAnimationOptions(options); diff --git a/src/qchart.h b/src/qchart.h index 3f02673..6f47830 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -46,6 +46,7 @@ class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) Q_PROPERTY(QMargins margins READ margins WRITE setMargins) Q_PROPERTY(QChart::ChartType chartType READ chartType) + Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) Q_ENUMS(ChartTheme) Q_ENUMS(AnimationOption) Q_ENUMS(ChartType) @@ -137,6 +138,12 @@ public: QMargins margins() const; QRectF plotArea() const; + void setPlotAreaBackgroundBrush(const QBrush &brush); + QBrush plotAreaBackgroundBrush() const; + void setPlotAreaBackgroundPen(const QPen &pen); + QPen plotAreaBackgroundPen() const; + void setPlotAreaBackgroundVisible(bool visible = true); + bool isPlotAreaBackgroundVisible() const; QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); diff --git a/tests/auto/qchart/tst_qchart.cpp b/tests/auto/qchart/tst_qchart.cpp index f92be64..4f78d4e 100644 --- a/tests/auto/qchart/tst_qchart.cpp +++ b/tests/auto/qchart/tst_qchart.cpp @@ -71,6 +71,12 @@ private slots: void backgroundPen(); void isBackgroundVisible_data(); void isBackgroundVisible(); + void plotAreaBackgroundBrush_data(); + void plotAreaBackgroundBrush(); + void plotAreaBackgroundPen_data(); + void plotAreaBackgroundPen(); + void isPlotAreaBackgroundVisible_data(); + void isPlotAreaBackgroundVisible(); void legend_data(); void legend(); void plotArea_data(); @@ -357,6 +363,52 @@ void tst_QChart::isBackgroundVisible() QCOMPARE(m_chart->isBackgroundVisible(), isBackgroundVisible); } +void tst_QChart::plotAreaBackgroundBrush_data() +{ + QTest::addColumn("plotAreaBackgroundBrush"); + QTest::newRow("null") << QBrush(); + QTest::newRow("blue") << QBrush(Qt::blue); + QTest::newRow("white") << QBrush(Qt::white); + QTest::newRow("black") << QBrush(Qt::black); +} + +void tst_QChart::plotAreaBackgroundBrush() +{ + QFETCH(QBrush, plotAreaBackgroundBrush); + m_chart->setPlotAreaBackgroundBrush(plotAreaBackgroundBrush); + QCOMPARE(m_chart->plotAreaBackgroundBrush(), plotAreaBackgroundBrush); +} + +void tst_QChart::plotAreaBackgroundPen_data() +{ + QTest::addColumn("plotAreaBackgroundPen"); + QTest::newRow("null") << QPen(); + QTest::newRow("blue") << QPen(Qt::blue); + QTest::newRow("white") << QPen(Qt::white); + QTest::newRow("black") << QPen(Qt::black); +} + + +void tst_QChart::plotAreaBackgroundPen() +{ + QFETCH(QPen, plotAreaBackgroundPen); + m_chart->setPlotAreaBackgroundPen(plotAreaBackgroundPen); + QCOMPARE(m_chart->plotAreaBackgroundPen(), plotAreaBackgroundPen); +} + +void tst_QChart::isPlotAreaBackgroundVisible_data() +{ + QTest::addColumn("isPlotAreaBackgroundVisible"); + QTest::newRow("true") << true; + QTest::newRow("false") << false; +} + +void tst_QChart::isPlotAreaBackgroundVisible() +{ + QFETCH(bool, isPlotAreaBackgroundVisible); + m_chart->setPlotAreaBackgroundVisible(isPlotAreaBackgroundVisible); + QCOMPARE(m_chart->isPlotAreaBackgroundVisible(), isPlotAreaBackgroundVisible); +} void tst_QChart::legend_data() { diff --git a/tests/polarcharttest/mainwindow.cpp b/tests/polarcharttest/mainwindow.cpp index 7e6cef0..92069a4 100644 --- a/tests/polarcharttest/mainwindow.cpp +++ b/tests/polarcharttest/mainwindow.cpp @@ -58,12 +58,16 @@ MainWindow::MainWindow(QWidget *parent) : m_radialShadesBrush(new QBrush(Qt::NoBrush)), m_labelBrush(new QBrush(Qt::black)), m_titleBrush(new QBrush(Qt::black)), + m_backgroundBrush(new QBrush(Qt::white)), + m_plotAreaBackgroundBrush(new QBrush(Qt::NoBrush)), m_angularShadesPen(new QPen(Qt::NoPen)), m_radialShadesPen(new QPen(Qt::NoPen)), m_labelPen(new QPen(Qt::NoPen)), m_titlePen(new QPen(Qt::NoPen)), m_gridPen(new QPen(QRgb(0x010101))), // Note: Pure black is default color, so it gets overridden by m_arrowPen(new QPen(QRgb(0x010101))), // default theme if set to that initially. This is an example of workaround. + m_backgroundPen(new QPen(Qt::NoPen)), + m_plotAreaBackgroundPen(new QPen(Qt::NoPen)), m_labelFormat(QString("%.2f")), m_animationOptions(QChart::NoAnimation), m_angularTitle(QString("Angular Title")), @@ -157,6 +161,8 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->series6checkBox, SIGNAL(clicked()), this, SLOT(series6CheckBoxChecked())); connect(ui->series7checkBox, SIGNAL(clicked()), this, SLOT(series7CheckBoxChecked())); connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(themeIndexChanged(int))); + connect(ui->backgroundComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundIndexChanged(int))); + connect(ui->plotAreaComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(plotAreaIndexChanged(int))); ui->chartView->setChart(m_chart); ui->chartView->setRenderHint(QPainter::Antialiasing); @@ -379,6 +385,10 @@ void MainWindow::initXYValueChart() m_chart->setAnimationOptions(m_animationOptions); //m_chart->legend()->setVisible(false); m_chart->setAcceptHoverEvents(true); + m_chart->setBackgroundBrush(*m_backgroundBrush); + m_chart->setBackgroundPen(*m_backgroundPen); + m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush); + m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen); } void MainWindow::setAngularAxis(MainWindow::AxisMode mode) @@ -1081,6 +1091,59 @@ void MainWindow::seriesClicked(const QPointF &point) } } +void MainWindow::backgroundIndexChanged(int index) +{ + delete m_backgroundBrush; + delete m_backgroundPen; + + switch (index) { + case 0: + m_backgroundBrush = new QBrush(Qt::white); + m_backgroundPen = new QPen(Qt::NoPen); + break; + case 1: + m_backgroundBrush = new QBrush(Qt::blue); + m_backgroundPen = new QPen(Qt::NoPen); + break; + case 2: + m_backgroundBrush = new QBrush(Qt::yellow); + m_backgroundPen = new QPen(Qt::black, 2); + break; + default: + break; + } + m_chart->setBackgroundBrush(*m_backgroundBrush); + m_chart->setBackgroundPen(*m_backgroundPen); +} + +void MainWindow::plotAreaIndexChanged(int index) +{ + delete m_plotAreaBackgroundBrush; + delete m_plotAreaBackgroundPen; + + switch (index) { + case 0: + m_plotAreaBackgroundBrush = new QBrush(Qt::green); + m_plotAreaBackgroundPen = new QPen(Qt::green); + m_chart->setPlotAreaBackgroundVisible(false); + break; + case 1: + m_plotAreaBackgroundBrush = new QBrush(Qt::magenta); + m_plotAreaBackgroundPen = new QPen(Qt::NoPen); + m_chart->setPlotAreaBackgroundVisible(true); + break; + case 2: + m_plotAreaBackgroundBrush = new QBrush(Qt::lightGray); + m_plotAreaBackgroundPen = new QPen(Qt::red, 6); + m_chart->setPlotAreaBackgroundVisible(true); + break; + default: + break; + } + m_chart->setPlotAreaBackgroundBrush(*m_plotAreaBackgroundBrush); + m_chart->setPlotAreaBackgroundPen(*m_plotAreaBackgroundPen); +} + void MainWindow::applyCategories() { // Basic layout is three categories, extended has five diff --git a/tests/polarcharttest/mainwindow.h b/tests/polarcharttest/mainwindow.h index 94aa7d8..643f9fc 100644 --- a/tests/polarcharttest/mainwindow.h +++ b/tests/polarcharttest/mainwindow.h @@ -85,6 +85,8 @@ public slots: void themeIndexChanged(int index); void seriesHovered(QPointF point, bool state); void seriesClicked(const QPointF &point); + void backgroundIndexChanged(int index); + void plotAreaIndexChanged(int index); private: enum AxisMode { @@ -121,12 +123,16 @@ private: QBrush *m_radialShadesBrush; QBrush *m_labelBrush; QBrush *m_titleBrush; + QBrush *m_backgroundBrush; + QBrush *m_plotAreaBackgroundBrush; QPen *m_angularShadesPen; QPen *m_radialShadesPen; QPen *m_labelPen; QPen *m_titlePen; QPen *m_gridPen; QPen *m_arrowPen; + QPen *m_backgroundPen; + QPen *m_plotAreaBackgroundPen; QString m_labelFormat; QFont m_currentLabelFont; QFont m_currentTitleFont; diff --git a/tests/polarcharttest/mainwindow.ui b/tests/polarcharttest/mainwindow.ui index 79cf379..4faffb5 100644 --- a/tests/polarcharttest/mainwindow.ui +++ b/tests/polarcharttest/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1207 - 905 + 1193 + 956 @@ -892,6 +892,74 @@ Hover coordinates here! + + + + 10 + 820 + 171 + 22 + + + + + 0 + 0 + + + + 0 + + + + Background: White + + + + + Background: Blue + + + + + Background: Yellow + Black Border + + + + + + + 10 + 850 + 171 + 22 + + + + + 0 + 0 + + + + 0 + + + + PlotArea: Transparent + + + + + PlotArea: Magenta + + + + + PlotArea: Gray + Red Border + + + @@ -901,7 +969,7 @@ 0 0 - 1207 + 1193 21 diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml b/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml index 07c9e8a..6e2c97e 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/Chart.qml @@ -19,7 +19,7 @@ ****************************************************************************/ import QtQuick 1.0 -import QtCommercial.Chart 1.2 +import QtCommercial.Chart 1.3 ChartView { id: chartView @@ -44,6 +44,7 @@ ChartView { onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled); onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name); onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name); + onPlotAreaColorChanged: console.log("chart.plotAreaColorChanged: " + chart.plotAreaColor); legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible); legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible); diff --git a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml index 28fe6ae..fdced78 100644 --- a/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml +++ b/tests/qmlchartproperties/qml/qmlchartproperties/ChartEditorProperties.qml @@ -50,6 +50,10 @@ Flow { onClicked: chart.backgroundColor = main.nextColor(); } Button { + text: "plot area color" + onClicked: chart.plotAreaColor = main.nextColor(); + } + Button { text: "drop shadow enabled" onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled; } diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml b/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml index 2f8b423..a639638 100644 --- a/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml +++ b/tests/quick2chartproperties/qml/quick2chartproperties/Chart.qml @@ -19,7 +19,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtCommercial.Chart 1.2 +import QtCommercial.Chart 1.3 ChartView { id: chartView @@ -44,6 +44,7 @@ ChartView { onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled); onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name); onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name); + onPlotAreaColorChanged: console.log("chart.plotAreaColorChanged: " + chart.plotAreaColor); legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible); legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible); diff --git a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml index f0e63a5..1bc14b4 100644 --- a/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml +++ b/tests/quick2chartproperties/qml/quick2chartproperties/ChartEditorProperties.qml @@ -50,6 +50,10 @@ Flow { onClicked: chart.backgroundColor = main.nextColor(); } Button { + text: "plot area color" + onClicked: chart.plotAreaColor = main.nextColor(); + } + Button { text: "drop shadow enabled" onClicked: chart.dropShadowEnabled = !chart.dropShadowEnabled; }