diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index 3ab8f973..03efa958 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -403,3 +403,20 @@ void UBGraphicsTextItemDelegate::scaleTextSize(qreal multiplyer) { ChangeTextSize(multiplyer, scaleSize); } + +QVariant UBGraphicsTextItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + if (change == QGraphicsItem::ItemSelectedChange) + { + if (delegated()->isSelected()) + { + QTextCursor c = delegated()->textCursor(); + if (c.hasSelection()) + { + c.clearSelection(); + delegated()->setTextCursor(c); + } + } + } + return UBGraphicsItemDelegate::itemChange(change, value); +} \ No newline at end of file diff --git a/src/domain/UBGraphicsTextItemDelegate.h b/src/domain/UBGraphicsTextItemDelegate.h index b01df4e2..26b3ba9b 100644 --- a/src/domain/UBGraphicsTextItemDelegate.h +++ b/src/domain/UBGraphicsTextItemDelegate.h @@ -40,6 +40,8 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate virtual ~UBGraphicsTextItemDelegate(); bool isEditable(); void scaleTextSize(qreal multiplyer); + virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); + public slots: void contentsChanged();