11#pragma once
22
3-
43#include < QObject>
54
6-
75#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
86
9- #include < QtCharts>
7+ #include < QtCharts>
108
11- using namespace QtCharts ;
9+ using namespace QtCharts ;
1210
1311#endif
1412
15-
1613#include < QChart>
1714#include < QGraphicsSvgItem>
1815
19-
2016#include " qplotmarker_global.hpp"
2117
22-
2318class QPlotMarkerPrivate ;
2419
25-
2620class QPLOTMARKER_EXPORT QPlotMarker : public QGraphicsWidget
2721{
2822 Q_OBJECT
2923 Q_DECLARE_PRIVATE (QPlotMarker)
3024 Q_PROPERTY (QColor markerColor READ color WRITE setColor NOTIFY colorChanged)
31- Q_PROPERTY (MovementStyle movement READ movementStyle WRITE setMovementStyle NOTIFY movementStyleChanged)
25+ Q_PROPERTY (
26+ MovementStyle movement READ movementStyle WRITE setMovementStyle NOTIFY movementStyleChanged)
3227 Q_PROPERTY (Qt::Orientation orientation READ orientation)
3328
3429public:
35-
36- enum MovementStyle
37- {
38- MOVEMENT_DEFAULT,
39- MOVEMENT_BY_POINTS
40- };
30+ enum MovementStyle { MOVEMENT_DEFAULT, MOVEMENT_BY_POINTS };
4131 Q_ENUM (MovementStyle)
4232
43-
44- enum MarkerButtonIcon
45- {
33+ enum MarkerButtonIcon {
4634 MARKER_BUTTON_ICON,
4735 MARKER_BUTTON_CONTROL,
4836 MARKER_BUTTON_SELECTED_ICON,
4937 MARKER_BUTTON_SELECTED_CONTROL
5038 };
5139 Q_ENUM (MarkerButtonIcon)
5240
53- enum MarkerOrientation
54- {
55- Horizontal = Qt::Horizontal,
56- Vertical = Qt::Vertical,
41+ enum MarkerOrientation {
42+ Horizontal = Qt::Horizontal,
43+ Vertical = Qt::Vertical,
5744 HorizontalInverted,
5845 VerticalInverted
5946 };
6047 Q_ENUM (MarkerOrientation)
6148
62- explicit QPlotMarker (QChart * parent,
63- const QColor & color = " black" ,
64- QPlotMarker::MarkerOrientation orientation = QPlotMarker::Horizontal);
49+ explicit QPlotMarker (
50+ QChart *parent,
51+ const QColor &color = " black" ,
52+ QPlotMarker::MarkerOrientation orientation = QPlotMarker::Horizontal);
6553
66- explicit QPlotMarker (QChart * parent,
67- const QColor & color = " black" ,
68- Qt::Orientation orientation = Qt::Horizontal);
54+ explicit QPlotMarker (
55+ QChart *parent, const QColor &color = " black" , Qt::Orientation orientation = Qt::Horizontal);
6956
7057 ~QPlotMarker () override ;
7158
72-
7359 QColor color () const ;
74- void setColor (const QColor & color);
60+ void setColor (const QColor &color);
7561
7662 MovementStyle movementStyle () const ;
77- void setMovementStyle ( MovementStyle style );
78-
63+ void setMovementStyle (MovementStyle style);
7964
8065 Qt::Orientation orientation () const ;
81- QPlotMarker:: MarkerOrientation markerOrientation () const ;
66+ MarkerOrientation markerOrientation () const ;
8267 bool isInverted () const ;
8368
8469 void setSelected (bool isSelect);
8570
8671 bool isIgnoreSelected () const ;
8772 void setIsIgnoreSelected (bool isIgnore);
8873
74+ QChart *chart () const ;
8975
90- QChart * chart () const ;
91-
92-
93- void move (const QPointF & position);
76+ void move (const QPointF &position);
9477 void move (qreal percent);
9578 void moveBegin ();
9679 void moveEnd ();
@@ -99,43 +82,39 @@ class QPLOTMARKER_EXPORT QPlotMarker : public QGraphicsWidget
9982
10083 QPointF pos () const ;
10184
102-
10385 bool hasFocus () const ;
10486 qreal markerValue () const ;
10587
106-
10788 void setIntersectionPointSize (qreal size);
10889 void setIntersectionLineSize (quint8 size);
10990 quint8 intersectionLineSize () const ;
11091
111- void setLabelFormat (const QString & format);
92+ void setLabelFormat (const QString &format);
11293
113-
114- void addIgnoreSeries ( QAbstractSeries * series );
115- void removeIgnoreSeries ( QAbstractSeries * series );
116- void setIgnoreSeries (const QList<QAbstractSeries *> & series );
94+ void addIgnoreSeries (QAbstractSeries *series);
95+ void removeIgnoreSeries (QAbstractSeries *series);
96+ void setIgnoreSeries (const QList<QAbstractSeries *> &series);
11797
11898 QList<QAbstractSeries *> ignoreSeries () const ;
11999
120100 qreal controlIconSize () const ;
121101 void setControlIconSize (qreal size);
122102
123- void setCoordFont (const QFont & font);
124- void setCoordPen (const QPen & pen);
103+ void setCoordFont (const QFont &font);
104+ void setCoordPen (const QPen &pen);
125105
126106 QString markerIcon (MarkerButtonIcon typeIcon) const ;
127- void setMarkerIcon (const QString & fileName, MarkerButtonIcon typeIcon);
128-
107+ void setMarkerIcon (const QString &fileName, MarkerButtonIcon typeIcon);
129108
130109 QRectF controlRect () const ;
131110
132111 // QGraphicsItem interface
133112 QRectF boundingRect () const override ;
134113
135114Q_SIGNALS:
136- void colorChanged (const QColor & color);
115+ void colorChanged (const QColor &color);
137116 void movementStyleChanged (MovementStyle style);
138- void positionChanged (const QPointF & position);
117+ void positionChanged (const QPointF &position);
139118
140119 void pressed (Qt::MouseButton button);
141120 void released (Qt::MouseButton button);
@@ -146,20 +125,17 @@ public slots:
146125
147126 void showCoordinates (bool isVisible);
148127
149- void activate ( bool isActivated );
128+ void activate (bool isActivated);
150129
151130 void update ();
152131
153132protected:
154-
155133 QScopedPointer<QPlotMarkerPrivate> d_ptr;
156134
157135 // QGraphicsItem interface
158136
159- QVariant itemChange (GraphicsItemChange change, const QVariant & value) override ;
137+ QVariant itemChange (GraphicsItemChange change, const QVariant &value) override ;
160138
161139private:
162140 Q_DISABLE_COPY (QPlotMarker)
163-
164-
165141};
0 commit comments