From 1fb5b5422151fe3b0018f5688828e9597a5feebe Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 8 May 2024 13:49:13 +0200 Subject: [PATCH] PE: Fix ProjectTreeWidget::expandedCount not to use 0 for error cases This would make ProjectTreeWidget::nodeForFile pick the wrong node due to nodeExpandCount having a lower count. In case of qml files there is the source file node and the resource file node pointing to the same file name, but the resource name has an invalid index (not visible in the project view) and shouldn't be preffered! Fixes: QTCREATORBUG-30571 Change-Id: I2aff7da9dd6d83222e341b5cbcb78db5cd6a9224 Reviewed-by: Reviewed-by: Alessandro Portale --- src/plugins/projectexplorer/projecttreewidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 774a8bb1604..db335d1ea28 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -308,11 +308,11 @@ ProjectTreeWidget::~ProjectTreeWidget() int ProjectTreeWidget::expandedCount(Node *node) { if (m_projectTreeWidgets.isEmpty()) - return 0; + return INT_MAX; FlatModel *model = m_projectTreeWidgets.first()->m_model; QModelIndex index = model->indexForNode(node); if (!index.isValid()) - return 0; + return INT_MAX; int count = 0; for (ProjectTreeWidget *tree : std::as_const(m_projectTreeWidgets)) {