From 2a443e618dc70c393c7675285cb2e94a4e4f6815 Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 3 Sep 2012 16:33:05 +0300 Subject: [PATCH 1/3] Fixed crash on removing fastAccessItems. --- src/domain/UBGraphicsScene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 47547198..5084f660 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -1386,7 +1386,7 @@ UBGraphicsGroupContainerItem *UBGraphicsScene::createGroup(QListaddToGroup(chItem); - mFastAccessItems.removeAll(item); + mFastAccessItems.removeAll(chItem); } } else { groupItem->addToGroup(item); From b21e00910831de9df56b828bbf8a5c70ab1016fd Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 3 Sep 2012 16:39:26 +0300 Subject: [PATCH 2/3] Delegate buttons takes mouse press and mouse release events immediately. Fix to Sankore-772. --- src/board/UBBoardView.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index ed75f550..5500ec9b 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -528,6 +528,8 @@ Here we determines cases when items should to get mouse press event at pressing return true; case DelegateButton::Type: + return true; + case UBGraphicsMediaItem::Type: return false; @@ -1123,6 +1125,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) else { if (isUBItem(movingItem) && + DelegateButton::Type != movingItem->type() && QGraphicsSvgItem::Type != movingItem->type() && UBGraphicsDelegateFrame::Type != movingItem->type() && UBToolWidget::Type != movingItem->type() && From 05f6cc364ff1c559ea59eeafa9835b74ec14947e Mon Sep 17 00:00:00 2001 From: Aleksei Kanash Date: Mon, 3 Sep 2012 19:25:42 +0300 Subject: [PATCH 3/3] Additional fix to Sankore-979 - improved cleaning mechanism for items on board. --- src/domain/UBGraphicsGroupContainerItem.cpp | 14 ++++++++++++++ src/domain/UBGraphicsGroupContainerItem.h | 2 ++ src/frameworks/UBCoreGraphicsScene.cpp | 14 +++----------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/domain/UBGraphicsGroupContainerItem.cpp b/src/domain/UBGraphicsGroupContainerItem.cpp index 10be1c4d..95b95af3 100644 --- a/src/domain/UBGraphicsGroupContainerItem.cpp +++ b/src/domain/UBGraphicsGroupContainerItem.cpp @@ -79,6 +79,8 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item) item->setPos(mapFromItem(item, 0, 0)); item->scene()->removeItem(item); + if (corescene()) + corescene()->removeItemFromDeletion(item); item->setParentItem(this); // removing position from translation component of the new transform @@ -225,6 +227,18 @@ void UBGraphicsGroupContainerItem::destroy() { remove(); } +void UBGraphicsGroupContainerItem::clearSource() +{ + foreach(QGraphicsItem *child, childItems()) + { + UBGraphicsItem *item = dynamic_cast(child); + if (item) + { + item->clearSource(); + } + } +} + void UBGraphicsGroupContainerItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (mDelegate->mousePressEvent(event)) { diff --git a/src/domain/UBGraphicsGroupContainerItem.h b/src/domain/UBGraphicsGroupContainerItem.h index 00f643d3..e8fa77eb 100644 --- a/src/domain/UBGraphicsGroupContainerItem.h +++ b/src/domain/UBGraphicsGroupContainerItem.h @@ -39,6 +39,8 @@ public: virtual void setUuid(const QUuid &pUuid); void destroy(); + virtual void clearSource(); + protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/frameworks/UBCoreGraphicsScene.cpp b/src/frameworks/UBCoreGraphicsScene.cpp index 1f306425..69297da7 100644 --- a/src/frameworks/UBCoreGraphicsScene.cpp +++ b/src/frameworks/UBCoreGraphicsScene.cpp @@ -52,6 +52,8 @@ UBCoreGraphicsScene::~UBCoreGraphicsScene() void UBCoreGraphicsScene::addItem(QGraphicsItem* item) { + addItemToDeletion(item); + if (item->type() == UBGraphicsGroupContainerItem::Type && item->childItems().count()) { foreach (QGraphicsItem *curItem, item->childItems()) { removeItemFromDeletion(curItem); @@ -76,17 +78,7 @@ bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item) { if(mItemsToDelete.contains(item)) { - UBGraphicsItem* item_casted = 0; - switch (item->type()) - { - case UBGraphicsMediaItem::Type: - item_casted = dynamic_cast(item); - break; - case UBGraphicsW3CWidgetItem::Type: - item_casted = dynamic_cast(item); - break; - } - + UBGraphicsItem *item_casted = dynamic_cast(item); if (0 != item_casted) item_casted->clearSource();