1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include "declarativeareaseries_p.h"
5#include "declarativelineseries_p.h"
6
7QT_BEGIN_NAMESPACE
8
9DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) :
10 QAreaSeries(parent),
11 m_axes(new DeclarativeAxes(this))
12{
13 connect(sender: m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisXChanged(QAbstractAxis*)));
14 connect(sender: m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisYChanged(QAbstractAxis*)));
15 connect(sender: m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
16 connect(sender: m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
17 connect(sender: m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisAngularChanged(QAbstractAxis*)));
18 connect(sender: m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisRadialChanged(QAbstractAxis*)));
19 connect(sender: this, SIGNAL(brushChanged()), receiver: this, SLOT(handleBrushChanged()));
20}
21
22void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries *series)
23{
24 QAreaSeries::setUpperSeries(series);
25}
26
27DeclarativeLineSeries *DeclarativeAreaSeries::upperSeries() const
28{
29 return qobject_cast<DeclarativeLineSeries *>(object: QAreaSeries::upperSeries());
30}
31
32void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries *series)
33{
34 QAreaSeries::setLowerSeries(series);
35}
36
37DeclarativeLineSeries *DeclarativeAreaSeries::lowerSeries() const
38{
39 return qobject_cast<DeclarativeLineSeries *>(object: QAreaSeries::lowerSeries());
40}
41
42qreal DeclarativeAreaSeries::borderWidth() const
43{
44 return pen().widthF();
45}
46
47void DeclarativeAreaSeries::setBorderWidth(qreal width)
48{
49 if (width != pen().widthF()) {
50 QPen p = pen();
51 p.setWidthF(width);
52 setPen(p);
53 emit borderWidthChanged(width);
54 }
55}
56
57QString DeclarativeAreaSeries::brushFilename() const
58{
59 return m_brushFilename;
60}
61
62void DeclarativeAreaSeries::setBrushFilename(const QString &brushFilename)
63{
64 QImage brushImage(brushFilename);
65 if (QAreaSeries::brush().textureImage() != brushImage) {
66 QBrush brush = QAreaSeries::brush();
67 brush.setTextureImage(brushImage);
68 QAreaSeries::setBrush(brush);
69 m_brushFilename = brushFilename;
70 m_brushImage = brushImage;
71 emit brushFilenameChanged(brushFilename);
72 }
73}
74
75void DeclarativeAreaSeries::handleBrushChanged()
76{
77 // If the texture image of the brush has changed along the brush
78 // the brush file name needs to be cleared.
79 if (!m_brushFilename.isEmpty() && QAreaSeries::brush().textureImage() != m_brushImage) {
80 m_brushFilename.clear();
81 emit brushFilenameChanged(brushFilename: QString());
82 }
83}
84
85void DeclarativeAreaSeries::setBrush(const QBrush &brush)
86{
87 QAreaSeries::setBrush(brush);
88 emit brushChanged();
89}
90
91QBrush DeclarativeAreaSeries::brush() const
92{
93 return QAreaSeries::brush();
94}
95
96QT_END_NAMESPACE
97
98#include "moc_declarativeareaseries_p.cpp"
99

source code of qtcharts/src/chartsqml2/declarativeareaseries.cpp