-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstickyline.h
39 lines (32 loc) · 1.04 KB
/
stickyline.h
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
#ifndef STICKYLINE_H
#define STICKYLINE_H
class StickyLine;
#include <QGraphicsItem>
#include <staffGamesConstants.h>
#include "stickylinesignalhandler.h"
class StickyLine : public QGraphicsItem
{
public:
StickyLine();
StickyLine(QPoint x, QPoint y);
StickyLine(QRectF);
StickyLine(int, int, int, int);
void setColour(QColor);
void setHighlight(QColor);
void userResult(bool);
void setCollisionMode(Qt::ItemSelectionMode mode);
void addSignalHandler(StickyLineSignalHandler*);
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode) const;
private:
QRectF m_rec;
QColor m_defaultColour;
QColor m_highlightColour;
Qt::ItemSelectionMode m_collisionMode;
StickyLineSignalHandler* m_signalHandler;
};
#endif // STICKYLINE_H