26 #ifndef QCP_LAYOUTELEMENT_AXISRECT_H
27 #define QCP_LAYOUTELEMENT_AXISRECT_H
29 #include "../global.h"
31 #include "../layout.h"
44 Q_PROPERTY(QPixmap background READ background WRITE setBackground)
45 Q_PROPERTY(
bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)
46 Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)
47 Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)
48 Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)
55 QPixmap background()
const {
return mBackgroundPixmap; }
56 bool backgroundScaled()
const {
return mBackgroundScaled; }
57 Qt::AspectRatioMode backgroundScaledMode()
const {
return mBackgroundScaledMode; }
58 Qt::Orientations rangeDrag()
const {
return mRangeDrag; }
59 Qt::Orientations rangeZoom()
const {
return mRangeZoom; }
60 QCPAxis *rangeDragAxis(Qt::Orientation orientation);
61 QCPAxis *rangeZoomAxis(Qt::Orientation orientation);
62 double rangeZoomFactor(Qt::Orientation orientation);
65 void setBackground(
const QPixmap &pm);
66 void setBackground(
const QPixmap &pm,
bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);
67 void setBackground(
const QBrush &brush);
68 void setBackgroundScaled(
bool scaled);
69 void setBackgroundScaledMode(Qt::AspectRatioMode mode);
70 void setRangeDrag(Qt::Orientations orientations);
71 void setRangeZoom(Qt::Orientations orientations);
74 void setRangeZoomFactor(
double horizontalFactor,
double verticalFactor);
75 void setRangeZoomFactor(
double factor);
80 QList<QCPAxis*> axes(QCPAxis::AxisTypes types)
const;
81 QList<QCPAxis*> axes()
const;
83 QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);
87 void setupFullAxesBox(
bool connectRanges=
false);
88 QList<QCPAbstractPlottable*> plottables()
const;
89 QList<QCPGraph*> graphs()
const;
90 QList<QCPAbstractItem*> items()
const;
93 int left()
const {
return mRect.left(); }
94 int right()
const {
return mRect.right(); }
95 int top()
const {
return mRect.top(); }
96 int bottom()
const {
return mRect.bottom(); }
97 int width()
const {
return mRect.width(); }
98 int height()
const {
return mRect.height(); }
99 QSize
size()
const {
return mRect.size(); }
100 QPoint
topLeft()
const {
return mRect.topLeft(); }
101 QPoint
topRight()
const {
return mRect.topRight(); }
104 QPoint
center()
const {
return mRect.center(); }
107 virtual void update(UpdatePhase phase);
108 virtual QList<QCPLayoutElement*>
elements(
bool recursive)
const;
112 QBrush mBackgroundBrush;
113 QPixmap mBackgroundPixmap;
114 QPixmap mScaledBackgroundPixmap;
115 bool mBackgroundScaled;
116 Qt::AspectRatioMode mBackgroundScaledMode;
118 Qt::Orientations mRangeDrag, mRangeZoom;
119 QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis, mRangeZoomVertAxis;
120 double mRangeZoomFactorHorz, mRangeZoomFactorVert;
122 QCPRange mDragStartHorzRange, mDragStartVertRange;
123 QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;
126 QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;
149 #endif // QCP_LAYOUTELEMENT_AXISRECT_H