@@ -70,18 +70,13 void Callout::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q | |||||
70 |
|
70 | |||
71 | void Callout::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
71 | void Callout::mousePressEvent(QGraphicsSceneMouseEvent *event) | |
72 | { |
|
72 | { | |
73 | if (m_rect.contains(event->pos())) { |
|
|||
74 | m_clickOffset = event->pos(); |
|
|||
75 |
|
|
73 | event->setAccepted(true); | |
76 | } else { |
|
|||
77 | event->setAccepted(false); |
|
|||
78 | } |
|
|||
79 | } |
|
74 | } | |
80 |
|
75 | |||
81 | void Callout::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
76 | void Callout::mouseMoveEvent(QGraphicsSceneMouseEvent *event) | |
82 | { |
|
77 | { | |
83 | if (event->buttons() & Qt::LeftButton){ |
|
78 | if (event->buttons() & Qt::LeftButton){ | |
84 |
setPos(mapToParent(event->pos() - |
|
79 | setPos(mapToParent(event->pos() - event->buttonDownPos(Qt::LeftButton))); | |
85 | event->setAccepted(true); |
|
80 | event->setAccepted(true); | |
86 | } else { |
|
81 | } else { | |
87 | event->setAccepted(false); |
|
82 | event->setAccepted(false); |
General Comments 0
You need to be logged in to leave comments.
Login now