projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
qtui: Keep editing topic while someone talks
[quassel.git]
/
src
/
client
/
treemodel.cpp
diff --git
a/src/client/treemodel.cpp
b/src/client/treemodel.cpp
index
ed8f12b
..
006434c
100644
(file)
--- a/
src/client/treemodel.cpp
+++ b/
src/client/treemodel.cpp
@@
-1,5
+1,5
@@
/***************************************************************************
/***************************************************************************
- * Copyright (C) 2005-20
18
by the Quassel Project *
+ * Copyright (C) 2005-20
20
by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-569,9
+569,15
@@
void TreeModel::debug_rowsAboutToBeRemoved(const QModelIndex& parent, int start,
parentItem = rootItem;
qDebug() << "debug_rowsAboutToBeRemoved" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end;
parentItem = rootItem;
qDebug() << "debug_rowsAboutToBeRemoved" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end;
+ // Make sure model is valid first
+ if (!parent.model()) {
+ qDebug() << "Parent model is not valid!" << end;
+ return;
+ }
+
QModelIndex child;
for (int i = end; i >= start; i--) {
QModelIndex child;
for (int i = end; i >= start; i--) {
- child = parent.
child(i, 0
);
+ child = parent.
model()->index(i, 0, parent
);
Q_ASSERT(parentItem->child(i));
qDebug() << ">>>" << i << child << child.data().toString();
}
Q_ASSERT(parentItem->child(i));
qDebug() << ">>>" << i << child << child.data().toString();
}
@@
-585,9
+591,15
@@
void TreeModel::debug_rowsInserted(const QModelIndex& parent, int start, int end
parentItem = rootItem;
qDebug() << "debug_rowsInserted:" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end;
parentItem = rootItem;
qDebug() << "debug_rowsInserted:" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end;
+ // Make sure model is valid first
+ if (!parent.model()) {
+ qDebug() << "Parent model is not valid!" << end;
+ return;
+ }
+
QModelIndex child;
for (int i = start; i <= end; i++) {
QModelIndex child;
for (int i = start; i <= end; i++) {
- child = parent.
child(i, 0
);
+ child = parent.
model()->index(i, 0, parent
);
Q_ASSERT(parentItem->child(i));
qDebug() << "<<<" << i << child << child.data().toString();
}
Q_ASSERT(parentItem->child(i));
qDebug() << "<<<" << i << child << child.data().toString();
}