X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.cpp;h=13b97f9baf7459641bbdd7089582a080723872f3;hp=5c23063dd3c7470d9600a827d93c70d32b94c7c0;hb=3c3a8f88f9aabd2f30df705fd1d8b147d6441968;hpb=fe9ec46e2b6394b7735a73da5c438b10ba7e5e82 diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 5c23063d..13b97f9b 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -29,13 +29,11 @@ *****************************************/ AbstractTreeItem::AbstractTreeItem(AbstractTreeItem *parent) : QObject(parent), - _flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled) + _flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled), + _treeItemFlags(0) { } -AbstractTreeItem::~AbstractTreeItem() { -} - bool AbstractTreeItem::newChild(AbstractTreeItem *item) { int newRow = childCount(); emit beginAppendChilds(newRow, newRow); @@ -68,6 +66,8 @@ bool AbstractTreeItem::removeChild(int row) { treeitem->deleteLater(); emit endRemoveChilds(); + checkForDeletion(); + return true; } @@ -84,6 +84,7 @@ void AbstractTreeItem::removeAllChilds() { childIter = _childItems.begin(); while(childIter != _childItems.end()) { child = *childIter; + child->setTreeItemFlags(0); // disable self deletion, as this would only fuck up consitency and the child gets deleted anyways child->removeAllChilds(); childIter++; } @@ -96,6 +97,8 @@ void AbstractTreeItem::removeAllChilds() { child->deleteLater(); } emit endRemoveChilds(); + + checkForDeletion(); } bool AbstractTreeItem::reParent(AbstractTreeItem *newParent) { @@ -114,6 +117,8 @@ bool AbstractTreeItem::reParent(AbstractTreeItem *newParent) { parent()->_childItems.removeAt(oldRow); emit parent()->endRemoveChilds(); + parent()->checkForDeletion(); + setParent(newParent); bool success = newParent->newChild(this);