Commit 8f43fc11 authored by Daniel Teske's avatar Daniel Teske
Browse files

FlatModel: Fix crash in ::flags() on being called on session node.



That only happens in the current qt5 dev branch, but this is saner.

Task-number: QTCREATORBUG-8664

Change-Id: I024e07ec10e10c2ff3fe294b7a7ea17ce91ff532
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 54d0f91b
...@@ -318,6 +318,8 @@ Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const ...@@ -318,6 +318,8 @@ Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const
// We control the only view, and that one does the checks // We control the only view, and that one does the checks
Qt::ItemFlags f = Qt::ItemIsSelectable|Qt::ItemIsEnabled; Qt::ItemFlags f = Qt::ItemIsSelectable|Qt::ItemIsEnabled;
if (Node *node = nodeForIndex(index)) { if (Node *node = nodeForIndex(index)) {
if (node == m_rootNode)
return 0; // no flags for session node...
if (!qobject_cast<ProjectNode *>(node)) { if (!qobject_cast<ProjectNode *>(node)) {
// either folder or file node // either folder or file node
if (node->projectNode()->supportedActions(node).contains(ProjectNode::Rename)) if (node->projectNode()->supportedActions(node).contains(ProjectNode::Rename))
......
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