Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef SELECTION_MOVE_RESIZER_H
00031 #define SELECTION_MOVE_RESIZER_H
00032
00033 #include <QWidget>
00034 #include <QList>
00035 #include <QRect>
00036
00037 class QPoint;
00038 class QwtPlotMarker;
00039 class QwtPlotCanvas;
00040 class LegendWidget;
00041 class ArrowMarker;
00042
00089 class SelectionMoveResizer : public QWidget
00090 {
00091 Q_OBJECT
00092
00093 public:
00095 SelectionMoveResizer(ArrowMarker *target);
00097 SelectionMoveResizer(QWidget *target);
00099 ~SelectionMoveResizer();
00102 virtual bool eventFilter(QObject *o, QEvent *e);
00104 bool contains(QWidget *w) const { return d_widgets.contains(w); };
00106 bool contains(ArrowMarker *m) const { return d_line_markers.contains(m); };
00107 void raiseTargets(bool on = true);
00108
00109 public slots:
00111 void add(ArrowMarker *target);
00113 void add(QWidget *target);
00115 int removeAll(ArrowMarker *target);
00117 int removeAll(QWidget *target);
00119 void recalcBoundingRect();
00120
00121 signals:
00123 void targetsChanged();
00124
00125 protected:
00127 enum Operation { None=-2, Move, Resize_N, Resize_NE, Resize_E, Resize_SE, Resize_S, Resize_SW, Resize_W, Resize_NW };
00128
00134 virtual void paintEvent(QPaintEvent *e);
00140 virtual void mousePressEvent(QMouseEvent *e);
00146 virtual void mouseMoveEvent(QMouseEvent *e);
00151 virtual void mouseReleaseEvent(QMouseEvent *e);
00156 virtual void keyPressEvent(QKeyEvent *e);
00158 virtual void mouseDoubleClickEvent(QMouseEvent *e);
00159
00160 private:
00162 static const int handler_size = 10;
00164 static const QRect handlerRect(QRect rect, Operation op);
00166 QRect operateOn(const QRect in);
00168 void operateOnTargets();
00170 void init();
00172 QRect boundingRectOf(QwtPlotMarker *target) const;
00174 QRect boundingRectOf(QwtPlotCanvas *canvas) const;
00175
00177 QList <ArrowMarker *> d_line_markers;
00179 QList <QWidget *> d_widgets;
00181 QRect d_bounding_rect;
00183 Operation d_op;
00185 QPoint d_op_start;
00187 QPoint d_op_dp;
00188
00189 private slots:
00191 void removeWidget(QObject* w) { removeAll((QWidget*) w); }
00192 };
00193
00194 #endif // ifndef SELECTION_MOVE_RESIZER_H