26 #ifndef QCP_LAYOUTELEMENT_LEGEND_H
27 #define QCP_LAYOUTELEMENT_LEGEND_H
29 #include "../global.h"
31 #include "../layout.h"
42 Q_PROPERTY(
QCPLegend* parentLegend READ parentLegend)
43 Q_PROPERTY(QFont font READ font WRITE setFont)
44 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
45 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
46 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
47 Q_PROPERTY(
bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)
48 Q_PROPERTY(
bool selected READ selected WRITE setSelected NOTIFY selectableChanged)
54 QCPLegend *parentLegend()
const {
return mParentLegend; }
55 QFont font()
const {
return mFont; }
56 QColor textColor()
const {
return mTextColor; }
57 QFont selectedFont()
const {
return mSelectedFont; }
58 QColor selectedTextColor()
const {
return mSelectedTextColor; }
59 bool selectable()
const {
return mSelectable; }
60 bool selected()
const {
return mSelected; }
63 void setFont(
const QFont &font);
64 void setTextColor(
const QColor &color);
65 void setSelectedFont(
const QFont &font);
66 void setSelectedTextColor(
const QColor &color);
67 Q_SLOT
void setSelectable(
bool selectable);
68 Q_SLOT
void setSelected(
bool selected);
71 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
74 void selectionChanged(
bool selected);
75 void selectableChanged(
bool selectable);
83 QColor mSelectedTextColor;
84 bool mSelectable, mSelected;
92 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
120 QPen getIconBorderPen()
const;
121 QColor getTextColor()
const;
122 QFont getFont()
const;
130 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)
131 Q_PROPERTY(QBrush brush READ brush WRITE setBrush)
132 Q_PROPERTY(QFont font READ font WRITE setFont)
133 Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
134 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)
135 Q_PROPERTY(
int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)
136 Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)
137 Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)
138 Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)
139 Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)
140 Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)
141 Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)
142 Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)
143 Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
155 Q_FLAGS(SelectablePart SelectableParts)
156 Q_DECLARE_FLAGS(SelectableParts, SelectablePart)
159 virtual ~QCPLegend();
162 QPen borderPen()
const {
return mBorderPen; }
163 QBrush brush()
const {
return mBrush; }
164 QFont font()
const {
return mFont; }
165 QColor textColor()
const {
return mTextColor; }
166 QSize iconSize()
const {
return mIconSize; }
167 int iconTextPadding()
const {
return mIconTextPadding; }
168 QPen iconBorderPen()
const {
return mIconBorderPen; }
169 SelectableParts selectableParts()
const {
return mSelectableParts; }
170 SelectableParts selectedParts()
const;
171 QPen selectedBorderPen()
const {
return mSelectedBorderPen; }
172 QPen selectedIconBorderPen()
const {
return mSelectedIconBorderPen; }
173 QBrush selectedBrush()
const {
return mSelectedBrush; }
174 QFont selectedFont()
const {
return mSelectedFont; }
175 QColor selectedTextColor()
const {
return mSelectedTextColor; }
178 void setBorderPen(
const QPen &pen);
179 void setBrush(
const QBrush &brush);
180 void setFont(
const QFont &font);
181 void setTextColor(
const QColor &color);
182 void setIconSize(
const QSize &size);
183 void setIconSize(
int width,
int height);
184 void setIconTextPadding(
int padding);
185 void setIconBorderPen(
const QPen &pen);
186 Q_SLOT
void setSelectableParts(
const SelectableParts &selectableParts);
187 Q_SLOT
void setSelectedParts(
const SelectableParts &selectedParts);
188 void setSelectedBorderPen(
const QPen &pen);
189 void setSelectedIconBorderPen(
const QPen &pen);
190 void setSelectedBrush(
const QBrush &brush);
191 void setSelectedFont(
const QFont &font);
192 void setSelectedTextColor(
const QColor &color);
195 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
200 int itemCount()
const;
204 bool removeItem(
int index);
207 QList<QCPAbstractLegendItem*> selectedItems()
const;
210 void selectionChanged(QCPLegend::SelectableParts parts);
211 void selectableChanged(QCPLegend::SelectableParts parts);
215 QPen mBorderPen, mIconBorderPen;
220 int mIconTextPadding;
221 SelectableParts mSelectedParts, mSelectableParts;
222 QPen mSelectedBorderPen, mSelectedIconBorderPen;
223 QBrush mSelectedBrush;
225 QColor mSelectedTextColor;
233 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
237 QPen getBorderPen()
const;
238 QBrush getBrush()
const;
246 Q_DECLARE_OPERATORS_FOR_FLAGS(
QCPLegend::SelectableParts)
247 Q_DECLARE_METATYPE(
QCPLegend::SelectablePart)
249 #endif // QCP_LAYOUTELEMENT_LEGEND_H
virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const
Definition: layout.h:142
virtual void draw(QCPPainter *painter)=0
virtual void parentPlotInitialized(QCustomPlot *parentPlot)
Definition: layout.cpp:562
virtual void deselectEvent(bool *selectionStateChanged)
Definition: layer.cpp:623
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const
Definition: layout.cpp:537
virtual void draw(QCPPainter *painter)
Definition: layout.h:143
virtual QRect clipRect() const
Definition: layer.cpp:567
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: core.h:42
Manages a legend inside a QCustomPlot.
Definition: layoutelement-legend.h:126
A layout that arranges child elements in a grid.
Definition: layout.h:193
QPainter subclass used internally.
Definition: painter.h:111
The abstract base class for all objects that form the layout system.
Definition: layout.h:65
The abstract base class for all entries in a QCPLegend.
Definition: layoutelement-legend.h:38
A legend item representing a plottable with an icon and the plottable name.
Definition: layoutelement-legend.h:102
virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
Definition: layer.cpp:603
SelectablePart
Definition: layoutelement-legend.h:151
virtual QSize minimumSizeHint() const
Definition: layout.cpp:496
The abstract base class for all data representing objects in a plot.
Definition: plottable.h:36
virtual QCP::Interaction selectionCategory() const
Definition: layer.cpp:553
Interaction
Definition: global.h:133