From aaa09c992141bc62bf838932b605400f6c7c26b5 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Fri, 25 Apr 2014 18:45:47 +0200 Subject: [PATCH] document removed if it contains only <> QGraphicsItems --- src/core/UBPersistenceManager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/UBPersistenceManager.cpp b/src/core/UBPersistenceManager.cpp index 94db4c2a..441c34ef 100644 --- a/src/core/UBPersistenceManager.cpp +++ b/src/core/UBPersistenceManager.cpp @@ -926,6 +926,24 @@ bool UBPersistenceManager::isEmpty(UBDocumentProxy* pDocumentProxy) mSceneCache.removeScene(pDocumentProxy,0); delete theSoleScene; } + else{ + //the scene can contain Delegate buttons and the selection frame + // but this doesn't means that there is something useful on the frame + bool usefulItemFound = false; + foreach(QGraphicsItem* eachItem, theSoleScene->getFastAccessItems()){ + if(eachItem->type() > QGraphicsItem::UserType + && eachItem->type() != UBGraphicsItemType::DelegateButtonType + && eachItem->type() != UBGraphicsItemType::SelectionFrameType){ + usefulItemFound = true; + break; + } + } + if(!usefulItemFound){ + mSceneCache.removeScene(pDocumentProxy,0); + delete theSoleScene; + empty = true; + } + } } else {