diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 6a5d44589db..a628d6df75b 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() + '/'