|
|
@ -274,37 +274,43 @@ 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 (value.toBool()) { //selected(true)
|
|
|
|
if (ubScene) { |
|
|
|
ubScene->setSelectedZLevel(delegated()); |
|
|
|
if (value.toBool()) { //selected(true)
|
|
|
|
} else { |
|
|
|
ubScene->setSelectedZLevel(delegated()); |
|
|
|
ubScene->setOwnZlevel(delegated()); |
|
|
|
} else { |
|
|
|
freeControls(); |
|
|
|
ubScene->setOwnZlevel(delegated()); |
|
|
|
|
|
|
|
freeControls(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
case QGraphicsItem::ItemVisibleHasChanged : |
|
|
|
} break; |
|
|
|
{ |
|
|
|
case QGraphicsItem::ItemVisibleHasChanged : |
|
|
|
bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control; |
|
|
|
{ |
|
|
|
showHide(shownOnDisplay); |
|
|
|
bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control; |
|
|
|
|
|
|
|
showHide(shownOnDisplay); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case QGraphicsItem::ItemPositionHasChanged : |
|
|
|
|
|
|
|
case QGraphicsItem::ItemTransformHasChanged : |
|
|
|
|
|
|
|
case QGraphicsItem::ItemZValueHasChanged : |
|
|
|
|
|
|
|
if (!controlsExist()) { |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); |
|
|
|
case QGraphicsItem::ItemPositionHasChanged : |
|
|
|
positionHandles(); |
|
|
|
case QGraphicsItem::ItemTransformHasChanged : |
|
|
|
if (ubScene) { |
|
|
|
case QGraphicsItem::ItemZValueHasChanged : |
|
|
|
ubScene->setModified(true); |
|
|
|
{ |
|
|
|
|
|
|
|
if (ubScene) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ubScene->setModified(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (controlsExist()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); |
|
|
|
|
|
|
|
positionHandles(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return value; |
|
|
|
return value; |
|
|
|