diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index e40e164d..370b3240 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -2769,6 +2769,12 @@ UBGraphicsTextItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::textItemFromSvg() } } + QTextCursor curCursor = textItem->textCursor(); + QTextCharFormat format; + + format.setFont(font); + curCursor.mergeCharFormat(format); + textItem->setTextCursor(curCursor); textItem->setFont(font); QStringRef fill = mXmlReader.attributes().value("color"); diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index f26d5ed1..962121a9 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -115,6 +115,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec , mToolBarUsed(useToolBar) { // NOOP + connect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged())); } void UBGraphicsItemDelegate::init() @@ -535,6 +536,12 @@ void UBGraphicsItemDelegate::commitUndoStep() } } +void UBGraphicsItemDelegate::onZoomChanged() +{ + mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); + + positionHandles(); +} void UBGraphicsItemDelegate::buildButtons() { diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index c45fd8be..fc5c460c 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -259,6 +259,8 @@ class UBGraphicsItemDelegate : public QObject void increaseZlevelTop(); void increaseZlevelBottom(); + void onZoomChanged(); + protected: virtual void buildButtons(); virtual void decorateMenu(QMenu *menu); diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index 3ab8f973..b24e81d4 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -322,6 +322,12 @@ void UBGraphicsTextItemDelegate::positionHandles() void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode changeMode) { + if (scaleSize == changeMode) + { + if (1 == factor) + return; + } + else if (0 == factor) return; @@ -403,3 +409,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); +} 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();