LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
plotitem.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <memory>
12
#include <optional>
13
#include <QtGlobal>
14
#include <QQuickPaintedItem>
15
#include "
qmlconfig.h
"
16
17
class
QwtPlot;
18
19
namespace
LC::Util
20
{
21
class
UTIL_QML_API
PlotItem
:
public
QQuickPaintedItem
22
{
23
Q_OBJECT
24
25
Q_PROPERTY (
QList<QPointF>
points
READ
GetPoints
WRITE
SetPoints
NOTIFY
pointsChanged
)
26
27
Q_PROPERTY (QVariant
multipoints
READ
GetMultipoints
WRITE
SetMultipoints
NOTIFY
multipointsChanged
)
28
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
)
33
34
Q_PROPERTY (
bool
yGridEnabled
READ
GetYGridEnabled
WRITE
SetYGridEnabled
NOTIFY
yGridChanged
)
35
Q_PROPERTY (
bool
yMinorGridEnabled
READ
GetYMinorGridEnabled
WRITE
SetYMinorGridEnabled
NOTIFY
yMinorGridChanged
)
36
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
)
43
44
Q_PROPERTY (QString
plotTitle
READ
GetPlotTitle
WRITE
SetPlotTitle
NOTIFY
plotTitleChanged
)
45
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
)
49
50
Q_PROPERTY (
int
xExtent
READ
GetXExtent
NOTIFY
extentsChanged
)
51
Q_PROPERTY (
int
yExtent
READ
GetYExtent
NOTIFY
extentsChanged
)
52
53
QList
<QPointF> Points_;
54
55
struct PointsSet
56
{
57
QColor Color_;
58
std::optional<QColor> BrushColor_;
59
QList<QPointF>
Points_;
60
};
61
QList<PointsSet>
Multipoints_;
62
63
double
MinXValue_ = -1;
64
double
MaxXValue_ = -1;
65
double
MinYValue_ = -1;
66
double
MaxYValue_ = -1;
67
68
bool
YGridEnabled_ =
false
;
69
bool
YMinorGridEnabled_ =
false
;
70
71
double
Alpha_ = 0.3;
72
73
QColor Color_;
74
75
bool
LeftAxisEnabled_ =
false
;
76
bool
BottomAxisEnabled_ =
false
;
77
78
QString LeftAxisTitle_;
79
QString BottomAxisTitle_;
80
81
QString PlotTitle_;
82
83
QColor BackgroundColor_;
84
QColor TextColor_;
85
QColor GridLinesColor_;
86
87
int
XExtent_ = 0;
88
int
YExtent_ = 0;
89
90
std::shared_ptr<QwtPlot> Plot_;
91
public
:
92
explicit
PlotItem
(QQuickItem* =
nullptr
);
93
94
QList<QPointF>
GetPoints ()
const
;
95
void
SetPoints (
const
QList<QPointF>
&);
96
97
QVariant GetMultipoints ()
const
;
98
void
SetMultipoints (
const
QVariant&);
99
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
);
108
109
bool
GetYGridEnabled ()
const
;
110
void
SetYGridEnabled (
bool
);
111
bool
GetYMinorGridEnabled ()
const
;
112
void
SetYMinorGridEnabled (
bool
);
113
114
double
GetAlpha ()
const
;
115
void
SetAlpha (
double
);
116
117
QColor GetColor ()
const
;
118
void
SetColor (
const
QColor&);
119
120
bool
GetLeftAxisEnabled ()
const
;
121
void
SetLeftAxisEnabled (
bool
);
122
bool
GetBottomAxisEnabled ()
const
;
123
void
SetBottomAxisEnabled (
bool
);
124
125
QString GetLeftAxisTitle ()
const
;
126
void
SetLeftAxisTitle (
const
QString&);
127
QString GetBottomAxisTitle ()
const
;
128
void
SetBottomAxisTitle (
const
QString&);
129
130
QString GetPlotTitle ()
const
;
131
void
SetPlotTitle (
const
QString&);
132
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&);
139
140
int
GetXExtent ()
const
;
141
int
GetYExtent ()
const
;
142
143
void
paint (QPainter*)
override
;
144
private
:
145
template
<
typename
T,
typename
Notifier>
146
void
SetNewValue (T val, T& ourVal, Notifier&& notifier);
147
148
int
CalcXExtent (QwtPlot&)
const
;
149
int
CalcYExtent (QwtPlot&)
const
;
150
signals:
151
void
pointsChanged
();
152
void
multipointsChanged
();
153
154
void
minXValueChanged
();
155
void
maxXValueChanged
();
156
void
minYValueChanged
();
157
void
maxYValueChanged
();
158
159
void
yGridChanged
();
160
void
yMinorGridChanged
();
161
162
void
alphaChanged
();
163
164
void
colorChanged
();
165
166
void
leftAxisEnabledChanged
();
167
void
bottomAxisEnabledChanged
();
168
169
void
leftAxisTitleChanged
();
170
void
bottomAxisTitleChanged
();
171
172
void
plotTitleChanged
();
173
174
void
backgroundChanged
();
175
void
textColorChanged
();
176
void
gridLinesColorChanged
();
177
178
void
extentsChanged
();
179
};
180
}
LC::Util::PlotItem
Definition
plotitem.h:22
LC::Util::PlotItem::GetYExtent
int GetYExtent() const
Definition
plotitem.cpp:298
LC::Util::PlotItem::bottomAxisEnabledChanged
void bottomAxisEnabledChanged()
LC::Util::PlotItem::textColor
QColor textColor
Definition
plotitem.h:47
LC::Util::PlotItem::SetLeftAxisTitle
void SetLeftAxisTitle(const QString &)
Definition
plotitem.cpp:238
LC::Util::PlotItem::colorChanged
void colorChanged()
LC::Util::PlotItem::plotTitleChanged
void plotTitleChanged()
LC::Util::PlotItem::GetYGridEnabled
bool GetYGridEnabled() const
Definition
plotitem.cpp:172
LC::Util::PlotItem::yGridChanged
void yGridChanged()
LC::Util::PlotItem::background
QColor background
Definition
plotitem.h:46
LC::Util::PlotItem::GetBackground
QColor GetBackground() const
Definition
plotitem.cpp:263
LC::Util::PlotItem::yMinorGridChanged
void yMinorGridChanged()
LC::Util::PlotItem::backgroundChanged
void backgroundChanged()
LC::Util::PlotItem::color
QColor color
Definition
plotitem.h:38
LC::Util::PlotItem::GetMaxYValue
double GetMaxYValue() const
Definition
plotitem.cpp:162
LC::Util::PlotItem::GetAlpha
double GetAlpha() const
Definition
plotitem.cpp:192
LC::Util::PlotItem::xExtent
int xExtent
Definition
plotitem.h:50
LC::Util::PlotItem::alphaChanged
void alphaChanged()
LC::Util::PlotItem::leftAxisTitleChanged
void leftAxisTitleChanged()
LC::Util::PlotItem::SetPlotTitle
void SetPlotTitle(const QString &)
Definition
plotitem.cpp:258
LC::Util::PlotItem::multipointsChanged
void multipointsChanged()
LC::Util::PlotItem::yMinorGridEnabled
bool yMinorGridEnabled
Definition
plotitem.h:35
LC::Util::PlotItem::SetBottomAxisEnabled
void SetBottomAxisEnabled(bool)
Definition
plotitem.cpp:228
LC::Util::PlotItem::SetMinYValue
void SetMinYValue(double)
Definition
plotitem.cpp:157
LC::Util::PlotItem::GetMinYValue
double GetMinYValue() const
Definition
plotitem.cpp:152
LC::Util::PlotItem::GetLeftAxisEnabled
bool GetLeftAxisEnabled() const
Definition
plotitem.cpp:213
LC::Util::PlotItem::SetMaxXValue
void SetMaxXValue(double)
Definition
plotitem.cpp:147
LC::Util::PlotItem::SetMinXValue
void SetMinXValue(double)
Definition
plotitem.cpp:137
LC::Util::PlotItem::textColorChanged
void textColorChanged()
LC::Util::PlotItem::GetColor
QColor GetColor() const
Definition
plotitem.cpp:203
LC::Util::PlotItem::GetYMinorGridEnabled
bool GetYMinorGridEnabled() const
Definition
plotitem.cpp:182
LC::Util::PlotItem::GetLeftAxisTitle
QString GetLeftAxisTitle() const
Definition
plotitem.cpp:233
LC::Util::PlotItem::leftAxisEnabled
bool leftAxisEnabled
Definition
plotitem.h:39
LC::Util::PlotItem::GetPoints
QList< QPointF > GetPoints() const
Definition
plotitem.cpp:35
LC::Util::PlotItem::minYValueChanged
void minYValueChanged()
LC::Util::PlotItem::SetMaxYValue
void SetMaxYValue(double)
Definition
plotitem.cpp:167
LC::Util::PlotItem::SetTextColor
void SetTextColor(const QColor &)
Definition
plotitem.cpp:278
LC::Util::PlotItem::GetBottomAxisTitle
QString GetBottomAxisTitle() const
Definition
plotitem.cpp:243
LC::Util::PlotItem::GetPlotTitle
QString GetPlotTitle() const
Definition
plotitem.cpp:253
LC::Util::PlotItem::leftAxisEnabledChanged
void leftAxisEnabledChanged()
LC::Util::PlotItem::leftAxisTitle
QString leftAxisTitle
Definition
plotitem.h:41
LC::Util::PlotItem::yGridEnabled
bool yGridEnabled
Definition
plotitem.h:34
LC::Util::PlotItem::SetBackground
void SetBackground(const QColor &)
Definition
plotitem.cpp:268
LC::Util::PlotItem::maxYValue
double maxYValue
Definition
plotitem.h:32
LC::Util::PlotItem::GetMinXValue
double GetMinXValue() const
Definition
plotitem.cpp:132
LC::Util::PlotItem::multipoints
QVariant multipoints
Definition
plotitem.h:27
LC::Util::PlotItem::GetXExtent
int GetXExtent() const
Definition
plotitem.cpp:293
LC::Util::PlotItem::bottomAxisEnabled
bool bottomAxisEnabled
Definition
plotitem.h:40
LC::Util::PlotItem::SetMultipoints
void SetMultipoints(const QVariant &)
Definition
plotitem.cpp:78
LC::Util::PlotItem::alpha
double alpha
Definition
plotitem.h:37
LC::Util::PlotItem::minXValueChanged
void minXValueChanged()
LC::Util::PlotItem::plotTitle
QString plotTitle
Definition
plotitem.h:44
LC::Util::PlotItem::bottomAxisTitle
QString bottomAxisTitle
Definition
plotitem.h:42
LC::Util::PlotItem::SetPoints
void SetPoints(const QList< QPointF > &)
Definition
plotitem.cpp:40
LC::Util::PlotItem::PlotItem
PlotItem(QQuickItem *=nullptr)
Definition
plotitem.cpp:28
LC::Util::PlotItem::GetBottomAxisEnabled
bool GetBottomAxisEnabled() const
Definition
plotitem.cpp:223
LC::Util::PlotItem::extentsChanged
void extentsChanged()
LC::Util::PlotItem::GetGridLinesColor
QColor GetGridLinesColor() const
Definition
plotitem.cpp:283
LC::Util::PlotItem::minYValue
double minYValue
Definition
plotitem.h:31
LC::Util::PlotItem::yExtent
int yExtent
Definition
plotitem.h:51
LC::Util::PlotItem::SetLeftAxisEnabled
void SetLeftAxisEnabled(bool)
Definition
plotitem.cpp:218
LC::Util::PlotItem::maxYValueChanged
void maxYValueChanged()
LC::Util::PlotItem::SetBottomAxisTitle
void SetBottomAxisTitle(const QString &)
Definition
plotitem.cpp:248
LC::Util::PlotItem::GetTextColor
QColor GetTextColor() const
Definition
plotitem.cpp:273
LC::Util::PlotItem::points
QList< QPointF > points
Definition
plotitem.h:25
LC::Util::PlotItem::gridLinesColorChanged
void gridLinesColorChanged()
LC::Util::PlotItem::SetGridLinesColor
void SetGridLinesColor(const QColor &)
Definition
plotitem.cpp:288
LC::Util::PlotItem::pointsChanged
void pointsChanged()
LC::Util::PlotItem::SetYMinorGridEnabled
void SetYMinorGridEnabled(bool)
Definition
plotitem.cpp:187
LC::Util::PlotItem::minXValue
double minXValue
Definition
plotitem.h:29
LC::Util::PlotItem::gridLinesColor
QColor gridLinesColor
Definition
plotitem.h:48
LC::Util::PlotItem::GetMultipoints
QVariant GetMultipoints() const
Definition
plotitem.cpp:50
LC::Util::PlotItem::SetColor
void SetColor(const QColor &)
Definition
plotitem.cpp:208
LC::Util::PlotItem::maxXValue
double maxXValue
Definition
plotitem.h:30
LC::Util::PlotItem::GetMaxXValue
double GetMaxXValue() const
Definition
plotitem.cpp:142
LC::Util::PlotItem::bottomAxisTitleChanged
void bottomAxisTitleChanged()
LC::Util::PlotItem::maxXValueChanged
void maxXValueChanged()
LC::Util::PlotItem::SetAlpha
void SetAlpha(double)
Definition
plotitem.cpp:197
LC::Util::PlotItem::SetYGridEnabled
void SetYGridEnabled(bool)
Definition
plotitem.cpp:177
QList
Definition
ianrulesstorage.h:14
LC::Util
Definition
icoreproxy.h:34
qmlconfig.h
UTIL_QML_API
#define UTIL_QML_API
Definition
qmlconfig.h:16
src
util
qml
plotitem.h
Generated by
1.17.0