editor.h
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef _EDITOR_H_
#define _EDITOR_H_
#include <qobject.h>
#include <qregion.h>
#include <qpointer.h>
#include <qwt_widget_overlay.h>
class QwtPlot;
class QwtPlotShapeItem;
class QPainter;
class QPoint;
class Editor: public QObject
{
Q_OBJECT
public:
enum Mode
{
NoMask,
Mask,
AlphaMask,
AlphaMaskRedraw,
AlphaMaskCopyMask
};
Editor( QwtPlot * );
virtual ~Editor();
const QwtPlot *plot() const;
QwtPlot *plot();
virtual void setEnabled( bool on );
bool isEnabled() const;
void drawOverlay( QPainter * ) const;
QRegion maskHint() const;
virtual bool eventFilter( QObject *, QEvent *);
void setMode( Mode mode );
Mode mode() const;
private:
bool pressed( const QPoint & );
bool moved( const QPoint & );
void released( const QPoint & );
QwtPlotShapeItem* itemAt( const QPoint& ) const;
void raiseItem( QwtPlotShapeItem * );
QRegion maskHint( QwtPlotShapeItem * ) const;
void setItemVisible( QwtPlotShapeItem *item, bool on );
bool d_isEnabled;
QPointer<QwtWidgetOverlay> d_overlay;
// Mouse positions
QPointF d_currentPos;
QwtPlotShapeItem* d_editedItem;
Mode d_mode;
};
#endif