projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
qa: Resolve Qt deprecation warnings - default-construct QFlags
[quassel.git]
/
src
/
client
/
treemodel.cpp
diff --git
a/src/client/treemodel.cpp
b/src/client/treemodel.cpp
index
8d6c882
..
3e243a4
100644
(file)
--- a/
src/client/treemodel.cpp
+++ b/
src/client/treemodel.cpp
@@
-45,7
+45,6
@@
private:
AbstractTreeItem::AbstractTreeItem(AbstractTreeItem* parent)
: QObject(parent)
, _flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled)
AbstractTreeItem::AbstractTreeItem(AbstractTreeItem* parent)
: QObject(parent)
, _flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled)
- , _treeItemFlags(nullptr)
{}
bool AbstractTreeItem::newChild(AbstractTreeItem* item)
{}
bool AbstractTreeItem::newChild(AbstractTreeItem* item)
@@
-102,7
+101,7
@@
void AbstractTreeItem::removeAllChilds()
childIter = _childItems.begin();
while (childIter != _childItems.end()) {
child = *childIter;
childIter = _childItems.begin();
while (childIter != _childItems.end()) {
child = *childIter;
- child->setTreeItemFlags(
nullptr
); // disable self deletion, as this would only fuck up consitency and the child gets deleted anyways
+ child->setTreeItemFlags(
{}
); // disable self deletion, as this would only fuck up consitency and the child gets deleted anyways
child->removeAllChilds();
++childIter;
}
child->removeAllChilds();
++childIter;
}
@@
-569,6
+568,12
@@
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--) {
child = parent.model()->index(i, 0, parent);
QModelIndex child;
for (int i = end; i >= start; i--) {
child = parent.model()->index(i, 0, parent);
@@
-585,6
+590,12
@@
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++) {
child = parent.model()->index(i, 0, parent);
QModelIndex child;
for (int i = start; i <= end; i++) {
child = parent.model()->index(i, 0, parent);