summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/projectmodels.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-09-16 16:05:30 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-09-17 08:47:36 +0000
commitb74b5a3ee6f8c59bf1e8feb23309210212240c66 (patch)
treeb5019a0c2b279fcdb58e82913d003982341b55ea /src/plugins/projectexplorer/projectmodels.cpp
parentfc35635942e7324737451db862cf896341149c55 (diff)
downloadqt-creator-b74b5a3ee6f8c59bf1e8feb23309210212240c66.tar.gz
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 <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/projectmodels.cpp')
-rw-r--r--src/plugins/projectexplorer/projectmodels.cpp8
1 files changed, 5 insertions, 3 deletions
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<Node *> candidateNodes = ProjectTree::siblingsWithSameBaseName(node);
if (!candidateNodes.isEmpty()) {
+ QStringList fileNames = transform<QStringList>(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<QStringList>(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() + '/'