|
|
@ -274,9 +274,10 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate() |
|
|
|
QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) |
|
|
|
QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBGraphicsScene *ubScene = castUBGraphicsScene(); |
|
|
|
UBGraphicsScene *ubScene = castUBGraphicsScene(); |
|
|
|
switch (static_cast<int>(change)) { |
|
|
|
switch (static_cast<int>(change)) |
|
|
|
|
|
|
|
{ |
|
|
|
case QGraphicsItem::ItemSelectedHasChanged : { |
|
|
|
case QGraphicsItem::ItemSelectedHasChanged : |
|
|
|
|
|
|
|
{ |
|
|
|
if (ubScene) { |
|
|
|
if (ubScene) { |
|
|
|
if (value.toBool()) { //selected(true)
|
|
|
|
if (value.toBool()) { //selected(true)
|
|
|
|
ubScene->setSelectedZLevel(delegated()); |
|
|
|
ubScene->setSelectedZLevel(delegated()); |
|
|
@ -285,8 +286,8 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch |
|
|
|
freeControls(); |
|
|
|
freeControls(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} break; |
|
|
|
} |
|
|
|
case QGraphicsItem::ItemVisibleHasChanged : |
|
|
|
case QGraphicsItem::ItemVisibleHasChanged : |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control; |
|
|
|
bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control; |
|
|
@ -296,16 +297,21 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch |
|
|
|
case QGraphicsItem::ItemPositionHasChanged : |
|
|
|
case QGraphicsItem::ItemPositionHasChanged : |
|
|
|
case QGraphicsItem::ItemTransformHasChanged : |
|
|
|
case QGraphicsItem::ItemTransformHasChanged : |
|
|
|
case QGraphicsItem::ItemZValueHasChanged : |
|
|
|
case QGraphicsItem::ItemZValueHasChanged : |
|
|
|
if (!controlsExist()) { |
|
|
|
{ |
|
|
|
break; |
|
|
|
if (ubScene) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ubScene->setModified(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (controlsExist()) |
|
|
|
|
|
|
|
{ |
|
|
|
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); |
|
|
|
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); |
|
|
|
positionHandles(); |
|
|
|
positionHandles(); |
|
|
|
if (ubScene) { |
|
|
|
break; |
|
|
|
ubScene->setModified(true); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return value; |
|
|
|
return value; |
|
|
|
} |
|
|
|
} |
|
|
|