-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3
-
None
-
openSUSE Leap 15.0
In an application using QTreeView and QFileSystemModel, if a file is renamed in the tree view, the model does not sort its contents and QTreeView keeps showing the renamed file at its old position.
This can be easily reproduced with "QTDIR/examples/widgets/itemviews/dirview/dirview.pro" by just adding "model.setReadOnly(false)".
This bug report corresponds to the meanwhile closed QTBUG-52479, but is related to LINUX.
Suggested fix (1):
bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, int role)
{
...
d->forceSort = true; // <=== added instruction
d->delayedSort();
emit fileRenamed(parentPath, oldName, newName);
}
return true;
}
Suggested fix (2):
Consider to place the added instruction (shown above) in QFileSystemModelPrivate::_q_performDelayedSort() and to remove its further occurrences, because this instruction seems to be always required:
void QFileSystemModelPrivate::_q_performDelayedSort()
{
Q_Q(QFileSystemModel);
forceSort = true; // <=== added instruction
q->sort(sortColumn, sortOrder);
}
- relates to
-
QTBUG-52479 Mac:QFileSystemModel does not sort if a file is renamed.
-
- Closed
-