-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuserselection.h
More file actions
41 lines (31 loc) · 850 Bytes
/
userselection.h
File metadata and controls
41 lines (31 loc) · 850 Bytes
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
#pragma once
#include <QObject>
#include <QRect>
// The object is tracking a user selection.
class UserSelection : public QObject
{
Q_OBJECT
public:
explicit UserSelection(QObject *parent = 0);
// Clears the selection.
void clear();
// Adds a selection point, e.g. from a mouse move.
void add(const QPoint& point);
// Returns true if the selection objets is not clean.
bool isSelected() const {
return _isSelected;
}
// Returns all selection track.
QList<QPoint> track() const {
return _track;
}
// Evaluates the selection rectangle.
// Returns null-rectangle if selection is not completed.
QRect getRect() const;
signals:
// Emitted on any selection state change.
void signalSelectionChanged();
private:
QList<QPoint> _track;
bool _isSelected;
};