diff options
Diffstat (limited to 'tagitem.cpp')
-rw-r--r-- | tagitem.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tagitem.cpp b/tagitem.cpp index 01b26fb..8c17ba6 100644 --- a/tagitem.cpp +++ b/tagitem.cpp @@ -11,7 +11,6 @@ TagItem::TagItem(const Tag &tag) , m_margins(2, 2, 2, 2)
{
setFlags(QGraphicsItem::ItemIsSelectable
- | QGraphicsItem::ItemIsMovable
| QGraphicsItem::ItemIsFocusable
| QGraphicsItem::ItemIgnoresTransformations
| QGraphicsItem::ItemSendsGeometryChanges);
@@ -97,6 +96,9 @@ QVariant TagItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVa *
*/
/* FIXME */
+ } else if (change == ItemSelectedChange) {
+ if (!value.toBool())
+ setFlag(QGraphicsItem::ItemIsMovable, false);
}
return QGraphicsItem::itemChange(change, value);
}
@@ -123,5 +125,10 @@ void TagItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
Q_UNUSED(event);
dragAboveThreshold = false;
+ if (isSelected())
+ setFlag(QGraphicsItem::ItemIsMovable, true);
+ else
+ setFlag(QGraphicsItem::ItemIsMovable, false);
+
QGraphicsItem::mouseReleaseEvent(event);
}
|