X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.cpp;h=0dc19b77da8adc9e8821f5237ed82064a2e0d4ed;hp=929622d6af3eb92ec81e5b6dfcce91027c217037;hb=2a04cb443a50e37165fc2d5447cc705a813efd3e;hpb=7df7429c009d2bea4c516e87f1ec4c956c722e09 diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 929622d6..0dc19b77 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -105,7 +105,6 @@ void AbstractTreeItem::removeAllChilds() { return; emit beginRemoveChilds(0, childCount() - 1); - AbstractTreeItem *child; foreach(int column, _childItems.keys()) { QList::iterator iter = _childItems[column].begin(); @@ -289,6 +288,19 @@ TreeModel::TreeModel(const QList &data, QObject *parent) : QAbstractItemModel(parent) { rootItem = new SimpleTreeItem(data, 0); + + connect(rootItem, SIGNAL(dataChanged(int)), + this, SLOT(itemDataChanged(int))); + + connect(rootItem, SIGNAL(newChild(AbstractTreeItem *)), + this, SLOT(newChild(AbstractTreeItem *))); + + connect(rootItem, SIGNAL(beginRemoveChilds(int, int)), + this, SLOT(beginRemoveChilds(int, int))); + + connect(rootItem, SIGNAL(endRemoveChilds()), + this, SLOT(endRemoveChilds())); + } TreeModel::~TreeModel() { @@ -429,7 +441,7 @@ void TreeModel::itemDataChanged(int column) { } void TreeModel::appendChild(AbstractTreeItem *parent, AbstractTreeItem *child) { - if(parent == 0 or child == 0) { + if(parent == 0 || child == 0) { qWarning() << "TreeModel::appendChild(parent, child) parent and child have to be valid pointers!" << parent << child; return; } @@ -507,6 +519,5 @@ bool TreeModel::removeRows(int row, int count, const QModelIndex &parent) { } void TreeModel::clear() { - removeRows(0, rowCount()); - reset(); + rootItem->removeAllChilds(); }