From b74b5a3ee6f8c59bf1e8feb23309210212240c66 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 16 Sep 2021 16:05:30 +0200 Subject: ProjectExplorer: Do not list files more than once in the rename dialog ... for project tree entries. The same file can occur more than once in the tree. Task-number: QTCREATORBUG-26268 Change-Id: I8af1e3a73d54e5a54c858fb3f7a8cf4afa83c7e2 Reviewed-by: hjk --- src/plugins/projectexplorer/projectmodels.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/projectexplorer/projectmodels.cpp') diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 6a5d44589d..a628d6df75 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -308,12 +308,14 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol if (orgFilePath != newFilePath && orgFilePath.suffix() == newFilePath.suffix()) { const QList candidateNodes = ProjectTree::siblingsWithSameBaseName(node); if (!candidateNodes.isEmpty()) { + QStringList fileNames = transform(candidateNodes, [](const Node *n) { + return n->filePath().fileName(); + }); + fileNames.removeDuplicates(); const QMessageBox::StandardButton reply = QMessageBox::question( Core::ICore::dialogParent(), tr("Rename More Files?"), tr("Would you like to rename these files as well?\n %1") - .arg(transform(candidateNodes, [](const Node *n) { - return n->filePath().fileName(); - }).join("\n "))); + .arg(fileNames.join("\n "))); if (reply == QMessageBox::Yes) { for (Node * const n : candidateNodes) { QString targetFilePath = orgFileInfo.absolutePath() + '/' -- cgit v1.2.1