14 #include <QQuickPaintedItem>
25 Q_PROPERTY (
QList<QPointF> points READ GetPoints WRITE SetPoints NOTIFY pointsChanged)
27 Q_PROPERTY (QVariant multipoints READ GetMultipoints WRITE SetMultipoints NOTIFY multipointsChanged)
29 Q_PROPERTY (
double minXValue READ GetMinXValue WRITE SetMinXValue NOTIFY minXValueChanged)
30 Q_PROPERTY (
double maxXValue READ GetMaxXValue WRITE SetMaxXValue NOTIFY maxXValueChanged)
31 Q_PROPERTY (
double minYValue READ GetMinYValue WRITE SetMinYValue NOTIFY minYValueChanged)
32 Q_PROPERTY (
double maxYValue READ GetMaxYValue WRITE SetMaxYValue NOTIFY maxYValueChanged)
34 Q_PROPERTY (
bool yGridEnabled READ GetYGridEnabled WRITE SetYGridEnabled NOTIFY yGridChanged)
35 Q_PROPERTY (
bool yMinorGridEnabled READ GetYMinorGridEnabled WRITE SetYMinorGridEnabled NOTIFY yMinorGridChanged)
37 Q_PROPERTY (
double alpha READ GetAlpha WRITE SetAlpha NOTIFY alphaChanged)
38 Q_PROPERTY (QColor color READ GetColor WRITE SetColor NOTIFY colorChanged)
39 Q_PROPERTY (
bool leftAxisEnabled READ GetLeftAxisEnabled WRITE SetLeftAxisEnabled NOTIFY leftAxisEnabledChanged)
40 Q_PROPERTY (
bool bottomAxisEnabled READ GetBottomAxisEnabled WRITE SetBottomAxisEnabled NOTIFY bottomAxisEnabledChanged)
41 Q_PROPERTY (QString leftAxisTitle READ GetLeftAxisTitle WRITE SetLeftAxisTitle NOTIFY leftAxisTitleChanged)
42 Q_PROPERTY (QString bottomAxisTitle READ GetBottomAxisTitle WRITE SetBottomAxisTitle NOTIFY bottomAxisTitleChanged)
44 Q_PROPERTY (QString plotTitle READ GetPlotTitle WRITE SetPlotTitle NOTIFY plotTitleChanged)
46 Q_PROPERTY (QColor background READ GetBackground WRITE SetBackground NOTIFY backgroundChanged)
47 Q_PROPERTY (QColor textColor READ GetTextColor WRITE SetTextColor NOTIFY textColorChanged)
48 Q_PROPERTY (QColor gridLinesColor READ GetGridLinesColor WRITE SetGridLinesColor NOTIFY gridLinesColorChanged)
50 Q_PROPERTY (
int xExtent READ GetXExtent NOTIFY extentsChanged)
51 Q_PROPERTY (
int yExtent READ GetYExtent NOTIFY extentsChanged)
53 QList<QPointF> Points_;
58 std::optional<QColor> BrushColor_;
63 double MinXValue_ = -1;
64 double MaxXValue_ = -1;
65 double MinYValue_ = -1;
66 double MaxYValue_ = -1;
68 bool YGridEnabled_ =
false;
69 bool YMinorGridEnabled_ =
false;
75 bool LeftAxisEnabled_ =
false;
76 bool BottomAxisEnabled_ =
false;
78 QString LeftAxisTitle_;
79 QString BottomAxisTitle_;
83 QColor BackgroundColor_;
85 QColor GridLinesColor_;
90 std::shared_ptr<QwtPlot> Plot_;
92 explicit PlotItem (QQuickItem* =
nullptr);
97 QVariant GetMultipoints ()
const;
98 void SetMultipoints (
const QVariant&);
100 double GetMinXValue ()
const;
101 void SetMinXValue (
double);
102 double GetMaxXValue ()
const;
103 void SetMaxXValue (
double);
104 double GetMinYValue ()
const;
105 void SetMinYValue (
double);
106 double GetMaxYValue ()
const;
107 void SetMaxYValue (
double);
109 bool GetYGridEnabled ()
const;
110 void SetYGridEnabled (
bool);
111 bool GetYMinorGridEnabled ()
const;
112 void SetYMinorGridEnabled (
bool);
114 double GetAlpha ()
const;
115 void SetAlpha (
double);
117 QColor GetColor ()
const;
118 void SetColor (
const QColor&);
120 bool GetLeftAxisEnabled ()
const;
121 void SetLeftAxisEnabled (
bool);
122 bool GetBottomAxisEnabled ()
const;
123 void SetBottomAxisEnabled (
bool);
125 QString GetLeftAxisTitle ()
const;
126 void SetLeftAxisTitle (
const QString&);
127 QString GetBottomAxisTitle ()
const;
128 void SetBottomAxisTitle (
const QString&);
130 QString GetPlotTitle ()
const;
131 void SetPlotTitle (
const QString&);
133 QColor GetBackground ()
const;
134 void SetBackground (
const QColor&);
135 QColor GetTextColor ()
const;
136 void SetTextColor (
const QColor&);
137 QColor GetGridLinesColor ()
const;
138 void SetGridLinesColor (
const QColor&);
140 int GetXExtent ()
const;
141 int GetYExtent ()
const;
143 void paint (QPainter*)
override;
145 template<
typename T,
typename Notifier>
146 void SetNewValue (T val, T& ourVal, Notifier&& notifier);
148 int CalcXExtent (QwtPlot&)
const;
149 int CalcYExtent (QwtPlot&)
const;
151 void pointsChanged ();
152 void multipointsChanged ();
154 void minXValueChanged ();
155 void maxXValueChanged ();
156 void minYValueChanged ();
157 void maxYValueChanged ();
159 void yGridChanged ();
160 void yMinorGridChanged ();
162 void alphaChanged ();
164 void colorChanged ();
166 void leftAxisEnabledChanged ();
167 void bottomAxisEnabledChanged ();
169 void leftAxisTitleChanged ();
170 void bottomAxisTitleChanged ();
172 void plotTitleChanged ();
174 void backgroundChanged ();
175 void textColorChanged ();
176 void gridLinesColorChanged ();
178 void extentsChanged ();