projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Aller guten Dinge sind drei! (please don't ask any questions...)
[quassel.git]
/
src
/
client
/
treemodel.cpp
diff --git
a/src/client/treemodel.cpp
b/src/client/treemodel.cpp
index
d84f0e0
..
fef6a21
100644
(file)
--- a/
src/client/treemodel.cpp
+++ b/
src/client/treemodel.cpp
@@
-165,8
+165,13
@@
bool TreeModel::removeRow(int row, const QModelIndex &parent) {
if(row > rowCount(parent))
return false;
if(row > rowCount(parent))
return false;
+ TreeItem *item;
+ if(!parent.isValid())
+ item = rootItem;
+ else
+ item = static_cast<TreeItem*>(parent.internalPointer());
+
beginRemoveRows(parent, row, row);
beginRemoveRows(parent, row, row);
- TreeItem *item = static_cast<TreeItem*>(parent.internalPointer());
item->removeChild(row);
endRemoveRows();
return true;
item->removeChild(row);
endRemoveRows();
return true;
@@
-181,8
+186,14
@@
bool TreeModel::removeRows(int row, int count, const QModelIndex &parent) {
if(row + count - 1 > rowCount(parent) || row < 0 || count < 0)
return false;
if(row + count - 1 > rowCount(parent) || row < 0 || count < 0)
return false;
+ TreeItem *item;
+ if(!parent.isValid())
+ item = rootItem;
+ else
+ item = static_cast<TreeItem*>(parent.internalPointer());
+
+
beginRemoveRows(parent, row, row + count - 1);
beginRemoveRows(parent, row, row + count - 1);
- TreeItem *item = static_cast<TreeItem*>(parent.internalPointer());
for(int i = row + count - 1; i >= 0; i--) {
item->removeChild(i);
}
for(int i = row + count - 1; i >= 0; i--) {
item->removeChild(i);
}
@@
-191,5
+202,5
@@
bool TreeModel::removeRows(int row, int count, const QModelIndex &parent) {
}
void TreeModel::clear() {
}
void TreeModel::clear() {
- removeRows(0, rowCount()
, QModelIndex()
);
+ removeRows(0, rowCount());
}
}