QtiPlot
0.9.8.2
Main Page
Related Pages
Classes
Files
File List
File Members
qtiplot
src
plot2D
SelectionMoveResizer.h
Go to the documentation of this file.
1
/***************************************************************************
2
File : SelectionMoveResizer.h
3
Project : QtiPlot
4
--------------------------------------------------------------------
5
Copyright : (C) 2007 by Knut Franke, 2008 by Ion Vasilief
6
Email (use @ for *) : knut.franke*gmx.de, ion_vasilief*yahoo.fr
7
Description : Selection of Widgets and QwtPlotMarkers
8
9
***************************************************************************/
10
11
/***************************************************************************
12
* *
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
17
* *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
22
* *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
27
* *
28
***************************************************************************/
29
30
#ifndef SELECTION_MOVE_RESIZER_H
31
#define SELECTION_MOVE_RESIZER_H
32
33
#include <QWidget>
34
#include <QList>
35
#include <QRect>
36
37
class
QPoint;
38
class
QwtPlotMarker;
39
class
QwtPlotCanvas;
40
class
LegendWidget
;
41
class
ArrowMarker
;
42
89
class
SelectionMoveResizer
:
public
QWidget
90
{
91
Q_OBJECT
92
93
public
:
95
SelectionMoveResizer
(
ArrowMarker
*target);
97
SelectionMoveResizer
(QWidget *target);
99
~SelectionMoveResizer
();
102
virtual
bool
eventFilter
(QObject *o, QEvent *e);
104
bool
contains
(QWidget *w)
const
{
return
d_widgets
.contains(w); };
105
QList <QWidget *>
widgetsList
()
const
{
return
d_widgets
; };
107
bool
contains
(
ArrowMarker
*m)
const
{
return
d_line_markers
.contains(m); };
108
void
raiseTargets
(
bool
on =
true
);
109
void
alignTargetsLeft
();
110
void
alignTargetsRight
();
111
void
alignTargetsTop
();
112
void
alignTargetsBottom
();
113
114
public
slots:
116
void
add
(
ArrowMarker
*target);
118
void
add
(QWidget *target);
120
int
removeAll
(
ArrowMarker
*target);
122
int
removeAll
(QWidget *target);
124
void
recalcBoundingRect
();
125
126
signals:
128
void
targetsChanged
();
129
130
protected
:
132
enum
Operation
{
None
=-2,
Move
,
Resize_N
,
Resize_NE
,
Resize_E
,
Resize_SE
,
Resize_S
,
Resize_SW
,
Resize_W
,
Resize_NW
};
133
139
virtual
void
paintEvent
(QPaintEvent *e);
145
virtual
void
mousePressEvent
(QMouseEvent *e);
151
virtual
void
mouseMoveEvent
(QMouseEvent *e);
156
virtual
void
mouseReleaseEvent
(QMouseEvent *e);
161
virtual
void
keyPressEvent
(QKeyEvent *e);
163
virtual
void
mouseDoubleClickEvent
(QMouseEvent *e);
164
165
private
:
167
static
const
int
handler_size
= 10;
169
static
const
QRect
handlerRect
(QRect rect,
Operation
op);
171
QRect
operateOn
(
const
QRect in);
173
void
operateOnTargets
();
175
void
init
();
177
QRect
boundingRectOf
(QwtPlotMarker *target)
const
;
179
QRect
boundingRectOf
(QwtPlotCanvas *canvas)
const
;
180
182
QList <ArrowMarker *>
d_line_markers
;
184
QList <QWidget *>
d_widgets
;
186
QRect
d_bounding_rect
;
188
Operation
d_op
;
190
QPoint
d_op_start
;
192
QPoint
d_op_dp
;
193
194
private
slots:
196
void
removeWidget
(QObject* w) {
removeAll
((QWidget*) w); }
197
};
198
199
#endif // ifndef SELECTION_MOVE_RESIZER_H
Generated on Sat Jun 8 2013 23:27:28 for QtiPlot by
1.8.3.1