|
|
@ -315,6 +315,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta |
|
|
|
, mpLastPolygon(NULL) |
|
|
|
, mpLastPolygon(NULL) |
|
|
|
, mCurrentPolygon(0) |
|
|
|
, mCurrentPolygon(0) |
|
|
|
, mSelectionFrame(0) |
|
|
|
, mSelectionFrame(0) |
|
|
|
|
|
|
|
, mNumberOfGroups(0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBCoreGraphicsScene::setObjectName("BoardScene"); |
|
|
|
UBCoreGraphicsScene::setObjectName("BoardScene"); |
|
|
|
setItemIndexMethod(NoIndex); |
|
|
|
setItemIndexMethod(NoIndex); |
|
|
@ -1101,30 +1102,19 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const |
|
|
|
copy->setNominalSize(this->mNominalSize); |
|
|
|
copy->setNominalSize(this->mNominalSize); |
|
|
|
|
|
|
|
|
|
|
|
QListIterator<QGraphicsItem*> itItems(this->mFastAccessItems); |
|
|
|
QListIterator<QGraphicsItem*> itItems(this->mFastAccessItems); |
|
|
|
|
|
|
|
|
|
|
|
QMap<UBGraphicsStroke*, UBGraphicsStroke*> groupClone; |
|
|
|
QMap<UBGraphicsStroke*, UBGraphicsStroke*> groupClone; |
|
|
|
|
|
|
|
|
|
|
|
QList<QUuid> groupAlreadyCloned; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (itItems.hasNext()) |
|
|
|
while (itItems.hasNext()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QGraphicsItem* item = itItems.next(); |
|
|
|
QGraphicsItem* item = itItems.next(); |
|
|
|
QGraphicsItem* cloneItem = 0; |
|
|
|
QGraphicsItem* cloneItem = 0; |
|
|
|
|
|
|
|
|
|
|
|
UBItem* ubItem = dynamic_cast<UBItem*>(item); |
|
|
|
UBItem* ubItem = dynamic_cast<UBItem*>(item); |
|
|
|
UBGraphicsStroke* stroke = dynamic_cast<UBGraphicsStroke*>(item); |
|
|
|
UBGraphicsStroke* stroke = dynamic_cast<UBGraphicsStroke*>(item); |
|
|
|
UBGraphicsGroupContainerItem* group = dynamic_cast<UBGraphicsGroupContainerItem*>(item); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ubItem && !stroke) |
|
|
|
if (ubItem && !stroke) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//horrible hack
|
|
|
|
cloneItem = dynamic_cast<QGraphicsItem*>(ubItem->deepCopy()); |
|
|
|
if(group && !groupAlreadyCloned.contains(group->uuid())){ |
|
|
|
|
|
|
|
cloneItem = dynamic_cast<QGraphicsItem*>(ubItem->deepCopy()); |
|
|
|
|
|
|
|
groupAlreadyCloned.append(group->uuid()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(!group) |
|
|
|
|
|
|
|
cloneItem = dynamic_cast<QGraphicsItem*>(ubItem->deepCopy()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (cloneItem) |
|
|
|
if (cloneItem) |
|
|
@ -1629,6 +1619,8 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q |
|
|
|
void UBGraphicsScene::addItem(QGraphicsItem* item) |
|
|
|
void UBGraphicsScene::addItem(QGraphicsItem* item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UBCoreGraphicsScene::addItem(item); |
|
|
|
UBCoreGraphicsScene::addItem(item); |
|
|
|
|
|
|
|
if(item->type() == UBGraphicsItemType::groupContainerType) |
|
|
|
|
|
|
|
mNumberOfGroups += 1; |
|
|
|
|
|
|
|
|
|
|
|
// the default z value is already set. This is the case when a svg file is read
|
|
|
|
// the default z value is already set. This is the case when a svg file is read
|
|
|
|
if(item->zValue() == DEFAULT_Z_VALUE || item->zValue() == UBZLayerController::errorNum()){ |
|
|
|
if(item->zValue() == DEFAULT_Z_VALUE || item->zValue() == UBZLayerController::errorNum()){ |
|
|
@ -1658,6 +1650,9 @@ void UBGraphicsScene::addItems(const QSet<QGraphicsItem*>& items) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsScene::removeItem(QGraphicsItem* item) |
|
|
|
void UBGraphicsScene::removeItem(QGraphicsItem* item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if(item->type() == UBGraphicsItemType::groupContainerType) |
|
|
|
|
|
|
|
mNumberOfGroups -= 1; |
|
|
|
|
|
|
|
|
|
|
|
item->setSelected(false); |
|
|
|
item->setSelected(false); |
|
|
|
UBCoreGraphicsScene::removeItem(item); |
|
|
|
UBCoreGraphicsScene::removeItem(item); |
|
|
|
UBApplication::boardController->freezeW3CWidget(item, true); |
|
|
|
UBApplication::boardController->freezeW3CWidget(item, true); |
|
|
@ -1674,6 +1669,8 @@ void UBGraphicsScene::removeItem(QGraphicsItem* item) |
|
|
|
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items) |
|
|
|
void UBGraphicsScene::removeItems(const QSet<QGraphicsItem*>& items) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach(QGraphicsItem* item, items) { |
|
|
|
foreach(QGraphicsItem* item, items) { |
|
|
|
|
|
|
|
if(item->type() == UBGraphicsItemType::groupContainerType) |
|
|
|
|
|
|
|
mNumberOfGroups -= 1; |
|
|
|
UBCoreGraphicsScene::removeItem(item); |
|
|
|
UBCoreGraphicsScene::removeItem(item); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|