1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "declarativesplineseries_p.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : |
9 | QSplineSeries(parent), |
10 | m_axes(new DeclarativeAxes(this)) |
11 | { |
12 | connect(sender: m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisXChanged(QAbstractAxis*))); |
13 | connect(sender: m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisYChanged(QAbstractAxis*))); |
14 | connect(sender: m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisXTopChanged(QAbstractAxis*))); |
15 | connect(sender: m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisYRightChanged(QAbstractAxis*))); |
16 | connect(sender: m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisAngularChanged(QAbstractAxis*))); |
17 | connect(sender: m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), receiver: this, SIGNAL(axisRadialChanged(QAbstractAxis*))); |
18 | connect(sender: this, SIGNAL(pointAdded(int)), receiver: this, SLOT(handleCountChanged(int))); |
19 | connect(sender: this, SIGNAL(pointRemoved(int)), receiver: this, SLOT(handleCountChanged(int))); |
20 | connect(sender: this, SIGNAL(pointsRemoved(int, int)), receiver: this, SLOT(handleCountChanged(int))); |
21 | } |
22 | |
23 | void DeclarativeSplineSeries::handleCountChanged(int index) |
24 | { |
25 | Q_UNUSED(index); |
26 | emit countChanged(count: points().size()); |
27 | } |
28 | |
29 | qreal DeclarativeSplineSeries::width() const |
30 | { |
31 | return pen().widthF(); |
32 | } |
33 | |
34 | void DeclarativeSplineSeries::setWidth(qreal width) |
35 | { |
36 | if (width != pen().widthF()) { |
37 | QPen p = pen(); |
38 | p.setWidthF(width); |
39 | setPen(p); |
40 | emit widthChanged(width); |
41 | } |
42 | } |
43 | |
44 | Qt::PenStyle DeclarativeSplineSeries::style() const |
45 | { |
46 | return pen().style(); |
47 | } |
48 | |
49 | void DeclarativeSplineSeries::setStyle(Qt::PenStyle style) |
50 | { |
51 | if (style != pen().style()) { |
52 | QPen p = pen(); |
53 | p.setStyle(style); |
54 | setPen(p); |
55 | emit styleChanged(style); |
56 | } |
57 | } |
58 | |
59 | Qt::PenCapStyle DeclarativeSplineSeries::capStyle() const |
60 | { |
61 | return pen().capStyle(); |
62 | } |
63 | |
64 | void DeclarativeSplineSeries::setCapStyle(Qt::PenCapStyle capStyle) |
65 | { |
66 | if (capStyle != pen().capStyle()) { |
67 | QPen p = pen(); |
68 | p.setCapStyle(capStyle); |
69 | setPen(p); |
70 | emit capStyleChanged(capStyle); |
71 | } |
72 | } |
73 | |
74 | QQmlListProperty<QObject> DeclarativeSplineSeries::declarativeChildren() |
75 | { |
76 | return QQmlListProperty<QObject>(this, 0, &appendDeclarativeChildren ,0,0,0); |
77 | } |
78 | |
79 | void DeclarativeSplineSeries::appendDeclarativeChildren(QQmlListProperty<QObject> *list, QObject *element) |
80 | { |
81 | Q_UNUSED(list); |
82 | Q_UNUSED(element); |
83 | // Empty implementation, children are parsed in componentComplete |
84 | } |
85 | |
86 | QT_END_NAMESPACE |
87 | |
88 | #include "moc_declarativesplineseries_p.cpp" |
89 | |