34 #include <boost/optional.hpp> 36 #if QT_VERSION < 0x050000 37 #include <QDeclarativeItem> 39 #include <QQuickPaintedItem> 49 #if QT_VERSION < 0x050000 57 Q_PROPERTY (
QList<QPointF> points READ GetPoints WRITE SetPoints NOTIFY pointsChanged)
59 Q_PROPERTY (QVariant multipoints READ GetMultipoints WRITE SetMultipoints NOTIFY multipointsChanged)
61 Q_PROPERTY (
double minXValue READ GetMinXValue WRITE SetMinXValue NOTIFY minXValueChanged)
62 Q_PROPERTY (
double maxXValue READ GetMaxXValue WRITE SetMaxXValue NOTIFY maxXValueChanged)
63 Q_PROPERTY (
double minYValue READ GetMinYValue WRITE SetMinYValue NOTIFY minYValueChanged)
64 Q_PROPERTY (
double maxYValue READ GetMaxYValue WRITE SetMaxYValue NOTIFY maxYValueChanged)
66 Q_PROPERTY (
bool yGridEnabled READ GetYGridEnabled WRITE SetYGridEnabled NOTIFY yGridChanged)
67 Q_PROPERTY (
bool yMinorGridEnabled READ GetYMinorGridEnabled WRITE SetYMinorGridEnabled NOTIFY yMinorGridChanged)
69 Q_PROPERTY (
double alpha READ GetAlpha WRITE SetAlpha NOTIFY alphaChanged)
70 Q_PROPERTY (QColor color READ GetColor WRITE SetColor NOTIFY colorChanged)
71 Q_PROPERTY (
bool leftAxisEnabled READ GetLeftAxisEnabled WRITE SetLeftAxisEnabled NOTIFY leftAxisEnabledChanged)
72 Q_PROPERTY (
bool bottomAxisEnabled READ GetBottomAxisEnabled WRITE SetBottomAxisEnabled NOTIFY bottomAxisEnabledChanged)
73 Q_PROPERTY (QString leftAxisTitle READ GetLeftAxisTitle WRITE SetLeftAxisTitle NOTIFY leftAxisTitleChanged)
74 Q_PROPERTY (QString bottomAxisTitle READ GetBottomAxisTitle WRITE SetBottomAxisTitle NOTIFY bottomAxisTitleChanged)
76 Q_PROPERTY (QString plotTitle READ GetPlotTitle WRITE SetPlotTitle NOTIFY plotTitleChanged)
78 Q_PROPERTY (QColor background READ GetBackground WRITE SetBackground NOTIFY backgroundChanged)
79 Q_PROPERTY (QColor textColor READ GetTextColor WRITE SetTextColor NOTIFY textColorChanged)
80 Q_PROPERTY (QColor gridLinesColor READ GetGridLinesColor WRITE SetGridLinesColor NOTIFY gridLinesColorChanged)
82 Q_PROPERTY (
int xExtent READ GetXExtent NOTIFY extentsChanged)
83 Q_PROPERTY (
int yExtent READ GetYExtent NOTIFY extentsChanged)
85 QList<QPointF> Points_;
90 boost::optional<QColor> BrushColor_;
95 double MinXValue_ = -1;
96 double MaxXValue_ = -1;
97 double MinYValue_ = -1;
98 double MaxYValue_ = -1;
100 bool YGridEnabled_ =
false;
101 bool YMinorGridEnabled_ =
false;
107 bool LeftAxisEnabled_ =
false;
108 bool BottomAxisEnabled_ =
false;
110 QString LeftAxisTitle_;
111 QString BottomAxisTitle_;
115 QColor BackgroundColor_;
117 QColor GridLinesColor_;
122 std::shared_ptr<QwtPlot> Plot_;
124 #if QT_VERSION < 0x050000 133 QVariant GetMultipoints ()
const;
134 void SetMultipoints (
const QVariant&);
136 double GetMinXValue ()
const;
137 void SetMinXValue (
double);
138 double GetMaxXValue ()
const;
139 void SetMaxXValue (
double);
140 double GetMinYValue ()
const;
141 void SetMinYValue (
double);
142 double GetMaxYValue ()
const;
143 void SetMaxYValue (
double);
145 bool GetYGridEnabled ()
const;
146 void SetYGridEnabled (
bool);
147 bool GetYMinorGridEnabled ()
const;
148 void SetYMinorGridEnabled (
bool);
150 double GetAlpha ()
const;
151 void SetAlpha (
double);
153 QColor GetColor ()
const;
154 void SetColor (
const QColor&);
156 bool GetLeftAxisEnabled ()
const;
157 void SetLeftAxisEnabled (
bool);
158 bool GetBottomAxisEnabled ()
const;
159 void SetBottomAxisEnabled (
bool);
161 QString GetLeftAxisTitle ()
const;
162 void SetLeftAxisTitle (
const QString&);
163 QString GetBottomAxisTitle ()
const;
164 void SetBottomAxisTitle (
const QString&);
166 QString GetPlotTitle ()
const;
167 void SetPlotTitle (
const QString&);
169 QColor GetBackground ()
const;
170 void SetBackground (
const QColor&);
171 QColor GetTextColor ()
const;
172 void SetTextColor (
const QColor&);
173 QColor GetGridLinesColor ()
const;
174 void SetGridLinesColor (
const QColor&);
176 int GetXExtent ()
const;
177 int GetYExtent ()
const;
179 #if QT_VERSION < 0x050000 180 void paint (QPainter*,
const QStyleOptionGraphicsItem*, QWidget*)
override;
182 void paint (QPainter*)
override;
186 void SetNewValue (T val, T& ourVal,
const std::function<
void ()>& notifier);
188 int CalcXExtent (QwtPlot&)
const;
189 int CalcYExtent (QwtPlot&)
const;
191 void pointsChanged ();
192 void multipointsChanged ();
194 void minXValueChanged ();
195 void maxXValueChanged ();
196 void minYValueChanged ();
197 void maxYValueChanged ();
199 void yGridChanged ();
200 void yMinorGridChanged ();
202 void alphaChanged ();
204 void colorChanged ();
206 void leftAxisEnabledChanged ();
207 void bottomAxisEnabledChanged ();
209 void leftAxisTitleChanged ();
210 void bottomAxisTitleChanged ();
212 void plotTitleChanged ();
214 void backgroundChanged ();
215 void textColorChanged ();
216 void gridLinesColorChanged ();
218 void extentsChanged ();