detect scene modifications (object translations for exemple) even if object controls are not visible

preferencesAboutTextFull
Clément Fauconnier 4 years ago
parent 6693da1818
commit c81138d9be
  1. 24
      src/domain/UBGraphicsItemDelegate.cpp
  2. 2
      src/domain/UBGraphicsScene.cpp

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

@ -1295,7 +1295,9 @@ void UBGraphicsScene::updateSelectionFrame()
{
if (!mSelectionFrame) {
mSelectionFrame = new UBSelectionFrame();
bool sceneWasModified = isModified();
addItem(mSelectionFrame);
setModified(sceneWasModified);
}
QList<QGraphicsItem*> selItems = selectedItems();

Loading…
Cancel
Save