diff options
Diffstat (limited to 'utils/themeeditor/graphics/rbmovable.cpp')
-rw-r--r-- | utils/themeeditor/graphics/rbmovable.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/utils/themeeditor/graphics/rbmovable.cpp b/utils/themeeditor/graphics/rbmovable.cpp index 11b3a6812f..3eca8bd18c 100644 --- a/utils/themeeditor/graphics/rbmovable.cpp +++ b/utils/themeeditor/graphics/rbmovable.cpp | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "rbmovable.h" | 25 | #include "rbmovable.h" |
26 | 26 | ||
27 | RBMovable::RBMovable(QGraphicsItem* parent) | 27 | RBMovable::RBMovable(QGraphicsItem* parent) |
28 | : QGraphicsItem(parent) | 28 | : QGraphicsItem(parent), geomChanged(false) |
29 | { | 29 | { |
30 | setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges); | 30 | setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges); |
31 | } | 31 | } |
@@ -61,7 +61,7 @@ QVariant RBMovable::itemChange(GraphicsItemChange change, const QVariant &value) | |||
61 | pos.setY(qMax(0., pos.y())); | 61 | pos.setY(qMax(0., pos.y())); |
62 | pos.setY(qMin(pos.y(), bound.height() - boundingRect().height())); | 62 | pos.setY(qMin(pos.y(), bound.height() - boundingRect().height())); |
63 | 63 | ||
64 | saveGeometry(); | 64 | geomChanged = true; |
65 | 65 | ||
66 | return pos; | 66 | return pos; |
67 | } | 67 | } |
@@ -69,3 +69,17 @@ QVariant RBMovable::itemChange(GraphicsItemChange change, const QVariant &value) | |||
69 | return QGraphicsItem::itemChange(change, value); | 69 | return QGraphicsItem::itemChange(change, value); |
70 | } | 70 | } |
71 | 71 | ||
72 | void RBMovable::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
73 | { | ||
74 | QGraphicsItem::mousePressEvent(event); | ||
75 | } | ||
76 | |||
77 | void RBMovable::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) | ||
78 | { | ||
79 | QGraphicsItem::mouseReleaseEvent(event); | ||
80 | if(isSelected()) | ||
81 | { | ||
82 | saveGeometry(); | ||
83 | geomChanged = false; | ||
84 | } | ||
85 | } | ||