Fixed deletion removed groups.

Code was cleaned.
Corrections in removing strokes.
preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 4b7939b6c3
commit 8b19847c11
  1. 2
      src/board/UBBoardController.cpp
  2. 4
      src/domain/UBGraphicsGroupContainerItem.cpp
  3. 4
      src/domain/UBGraphicsPolygonItem.cpp
  4. 17
      src/domain/UBGraphicsScene.cpp

@ -1495,7 +1495,7 @@ void UBBoardController::ClearUndoStack()
while (itRemoved.hasNext())
{
QGraphicsItem* item = itRemoved.next();
if( !uniqueItems.contains(item) && (item->parentItem() && UBGraphicsGroupContainerItem::Type != item->parentItem()->type()))
if( !uniqueItems.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()))
uniqueItems.insert(item);
}
}

@ -219,10 +219,6 @@ void UBGraphicsGroupContainerItem::destroy() {
UBCoreGraphicsScene *groupScene = corescene();
if (groupScene) {
// groupScene->addItemToDeletion(this);
}
foreach (QGraphicsItem *item, childItems()) {
pRemoveFromGroup(item);
item->setFlag(QGraphicsItem::ItemIsSelectable, true);

@ -67,8 +67,8 @@ void UBGraphicsPolygonItem::clearStroke()
if (mStroke!=NULL)
{
mStroke->remove(this);
//if (mStroke->polygons().empty())
// delete mStroke;
if (mStroke->polygons().empty())
delete mStroke;
mStroke = NULL;
}
}

@ -305,7 +305,10 @@ UBGraphicsScene::~UBGraphicsScene()
{
if (mCurrentStroke)
if (mCurrentStroke->polygons().empty())
{
delete mCurrentStroke;
mCurrentStroke = NULL;
}
if (mZLayerController)
delete mZLayerController;
@ -433,6 +436,11 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
}
}
if (mCurrentStroke && mCurrentStroke->polygons().empty()){
delete mCurrentStroke;
mCurrentStroke = NULL;
}
return accepted;
}
@ -474,6 +482,10 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
UBCoreGraphicsScene::removeItemFromDeletion(mpLastPolygon);
mAddedItems.remove(mpLastPolygon);
mCurrentStroke->remove(mpLastPolygon);
if (mCurrentStroke->polygons().empty()){
delete mCurrentStroke;
mCurrentStroke = NULL;
}
removeItem(mpLastPolygon);
mPreviousPolygonItems.removeAll(mpLastPolygon);
}
@ -2285,6 +2297,11 @@ void UBGraphicsScene::setToolCursor(int tool)
{
deselectAllItems();
}
if (mCurrentStroke && mCurrentStroke->polygons().empty()){
delete mCurrentStroke;
}
mCurrentStroke = NULL;
}
void UBGraphicsScene::initStroke(){

Loading…
Cancel
Save