42 Q_PROPERTY(QString name READ name)
43 Q_PROPERTY(
int index READ index)
44 Q_PROPERTY(QList<QCPLayerable*> children READ children)
45 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
52 QCustomPlot *parentPlot()
const {
return mParentPlot; }
53 QString name()
const {
return mName; }
54 int index()
const {
return mIndex; }
55 QList<QCPLayerable*>
children()
const {
return mChildren; }
56 bool visible()
const {
return mVisible; }
59 void setVisible(
bool visible);
66 QList<QCPLayerable*> mChildren;
80 class QCP_LIB_DECL QCPLayerable : public QObject
84 Q_PROPERTY(
bool visible READ visible WRITE setVisible)
85 Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)
86 Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable)
87 Q_PROPERTY(
QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)
88 Q_PROPERTY(
bool antialiased READ antialiased WRITE setAntialiased)
91 QCPLayerable(QCustomPlot *plot, QString targetLayer=
"", QCPLayerable *parentLayerable=0);
95 bool visible()
const {
return mVisible; }
96 QCustomPlot *parentPlot()
const {
return mParentPlot; }
98 QCPLayer *layer()
const {
return mLayer; }
99 bool antialiased()
const {
return mAntialiased; }
102 void setVisible(
bool on);
103 Q_SLOT
bool setLayer(
QCPLayer *layer);
104 bool setLayer(
const QString &layerName);
105 void setAntialiased(
bool enabled);
108 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
111 bool realVisibility()
const;
114 void layerChanged(
QCPLayer *newLayer);
119 QCustomPlot *mParentPlot;
120 QPointer<QCPLayerable> mParentLayerable;
125 virtual void parentPlotInitialized(QCustomPlot *parentPlot);
127 virtual QRect clipRect()
const;
128 virtual void applyDefaultAntialiasingHint(
QCPPainter *painter)
const = 0;
131 virtual void selectEvent(QMouseEvent *event,
bool additive,
const QVariant &details,
bool *selectionStateChanged);
132 virtual void deselectEvent(
bool *selectionStateChanged);
135 void initializeParentPlot(QCustomPlot *parentPlot);
136 void setParentLayerable(QCPLayerable* parentLayerable);
137 bool moveToLayer(
QCPLayer *layer,
bool prepend);
141 Q_DISABLE_COPY(QCPLayerable)
143 friend class QCustomPlot;
147 #endif // QCP_LAYER_H