34 #include <boost/optional.hpp>
36 #if QT_VERSION < 0x050000
37 #include <QDeclarativeItem>
39 #include <QQuickPaintedItem>
53 Q_PROPERTY (
QList<QPointF> points READ GetPoints WRITE SetPoints NOTIFY pointsChanged)
55 Q_PROPERTY (QVariant multipoints READ GetMultipoints WRITE SetMultipoints NOTIFY multipointsChanged)
57 Q_PROPERTY (
double minXValue READ GetMinXValue WRITE SetMinXValue NOTIFY minXValueChanged)
58 Q_PROPERTY (
double maxXValue READ GetMaxXValue WRITE SetMaxXValue NOTIFY maxXValueChanged)
59 Q_PROPERTY (
double minYValue READ GetMinYValue WRITE SetMinYValue NOTIFY minYValueChanged)
60 Q_PROPERTY (
double maxYValue READ GetMaxYValue WRITE SetMaxYValue NOTIFY maxYValueChanged)
62 Q_PROPERTY (
bool yGridEnabled READ GetYGridEnabled WRITE SetYGridEnabled NOTIFY yGridChanged)
63 Q_PROPERTY (
bool yMinorGridEnabled READ GetYMinorGridEnabled WRITE SetYMinorGridEnabled NOTIFY yMinorGridChanged)
65 Q_PROPERTY (
double alpha READ GetAlpha WRITE SetAlpha NOTIFY alphaChanged)
66 Q_PROPERTY (QColor color READ GetColor WRITE SetColor NOTIFY colorChanged)
67 Q_PROPERTY (
bool leftAxisEnabled READ GetLeftAxisEnabled WRITE SetLeftAxisEnabled NOTIFY leftAxisEnabledChanged)
68 Q_PROPERTY (
bool bottomAxisEnabled READ GetBottomAxisEnabled WRITE SetBottomAxisEnabled NOTIFY bottomAxisEnabledChanged)
69 Q_PROPERTY (QString leftAxisTitle READ GetLeftAxisTitle WRITE SetLeftAxisTitle NOTIFY leftAxisTitleChanged)
70 Q_PROPERTY (QString bottomAxisTitle READ GetBottomAxisTitle WRITE SetBottomAxisTitle NOTIFY bottomAxisTitleChanged)
72 Q_PROPERTY (QString plotTitle READ GetPlotTitle WRITE SetPlotTitle NOTIFY plotTitleChanged)
74 Q_PROPERTY (QColor background READ GetBackground WRITE SetBackground NOTIFY backgroundChanged)
75 Q_PROPERTY (QColor textColor READ GetTextColor WRITE SetTextColor NOTIFY textColorChanged)
76 Q_PROPERTY (QColor gridLinesColor READ GetGridLinesColor WRITE SetGridLinesColor NOTIFY gridLinesColorChanged)
78 Q_PROPERTY (
int xExtent READ GetXExtent NOTIFY extentsChanged)
79 Q_PROPERTY (
int yExtent READ GetYExtent NOTIFY extentsChanged)
91 double MinXValue_ = -1;
92 double MaxXValue_ = -1;
93 double MinYValue_ = -1;
94 double MaxYValue_ = -1;
96 bool YGridEnabled_ =
false;
97 bool YMinorGridEnabled_ =
false;
103 bool LeftAxisEnabled_ =
false;
104 bool BottomAxisEnabled_ =
false;
120 #if QT_VERSION < 0x050000
129 QVariant GetMultipoints ()
const;
130 void SetMultipoints (
const QVariant&);
132 double GetMinXValue ()
const;
133 void SetMinXValue (
double);
134 double GetMaxXValue ()
const;
135 void SetMaxXValue (
double);
136 double GetMinYValue ()
const;
137 void SetMinYValue (
double);
138 double GetMaxYValue ()
const;
139 void SetMaxYValue (
double);
141 bool GetYGridEnabled ()
const;
142 void SetYGridEnabled (
bool);
143 bool GetYMinorGridEnabled ()
const;
144 void SetYMinorGridEnabled (
bool);
146 double GetAlpha ()
const;
147 void SetAlpha (
double);
149 QColor GetColor ()
const;
150 void SetColor (
const QColor&);
152 bool GetLeftAxisEnabled ()
const;
153 void SetLeftAxisEnabled (
bool);
154 bool GetBottomAxisEnabled ()
const;
155 void SetBottomAxisEnabled (
bool);
157 QString GetLeftAxisTitle ()
const;
158 void SetLeftAxisTitle (
const QString&);
159 QString GetBottomAxisTitle ()
const;
160 void SetBottomAxisTitle (
const QString&);
162 QString GetPlotTitle ()
const;
163 void SetPlotTitle (
const QString&);
165 QColor GetBackground ()
const;
166 void SetBackground (
const QColor&);
167 QColor GetTextColor ()
const;
168 void SetTextColor (
const QColor&);
169 QColor GetGridLinesColor ()
const;
170 void SetGridLinesColor (
const QColor&);
172 int GetXExtent ()
const;
173 int GetYExtent ()
const;
175 #if QT_VERSION < 0x050000
176 void paint (QPainter*,
const QStyleOptionGraphicsItem*, QWidget*)
override;
178 void paint (QPainter*)
override;
182 void SetNewValue (T val, T& ourVal,
const std::function<
void ()>& notifier);
184 int CalcXExtent (QwtPlot&)
const;
185 int CalcYExtent (QwtPlot&)
const;
187 void pointsChanged ();
188 void multipointsChanged ();
190 void minXValueChanged ();
191 void maxXValueChanged ();
192 void minYValueChanged ();
193 void maxYValueChanged ();
195 void yGridChanged ();
196 void yMinorGridChanged ();
198 void alphaChanged ();
200 void colorChanged ();
202 void leftAxisEnabledChanged ();
203 void bottomAxisEnabledChanged ();
205 void leftAxisTitleChanged ();
206 void bottomAxisTitleChanged ();
208 void plotTitleChanged ();
210 void backgroundChanged ();
211 void textColorChanged ();
212 void gridLinesColorChanged ();
214 void extentsChanged ();
QList< PointsSet > Multipoints_
std::shared_ptr< QwtPlot > Plot_
boost::optional< QColor > BrushColor_