Commit 60be34ee authored by Tobias Hunger's avatar Tobias Hunger
Browse files

ProjectNodes: Do not try to sort directories not yet mapped

Do not try to sort directories that were not yet mapped into the
FlatModel. This avoids an assert where QModelIndex is out of range
(-1) because the data for that directory is not yet available in
the model.

Do not bother to map the data, just forget the request to sort in
this case as the data will be sorted when it gets mapped anyway.

Task-number: QBS-521
Change-Id: I19de7513405e6a0b84c988a2a86f763e3135811d
Reviewed-by: default avatarDaniel Teske <>
parent 136f58c1
...@@ -823,6 +823,9 @@ void FlatModel::removeFromCache(QList<FolderNode *> list) ...@@ -823,6 +823,9 @@ void FlatModel::removeFromCache(QList<FolderNode *> list)
void FlatModel::changedSortKey(FolderNode *folderNode, Node *node) void FlatModel::changedSortKey(FolderNode *folderNode, Node *node)
{ {
if (!m_childNodes.contains(folderNode))
return; // The directory was not yet mapped, so there is no need to sort it.
QList<Node *> nodes = m_childNodes.value(folderNode); QList<Node *> nodes = m_childNodes.value(folderNode);
int oldIndex = nodes.indexOf(node); int oldIndex = nodes.indexOf(node);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment