diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 5f5aa0150e1..b7be5e1546b 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -284,8 +284,9 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol QTC_ASSERT(node, return false); std::vector> toRename; - const Utils::FilePath orgFilePath = node->filePath(); - const Utils::FilePath newFilePath = orgFilePath.parentDir().pathAppended(value.toString()); + const FilePath orgFilePath = node->filePath(); + const FilePath newFilePath = orgFilePath.parentDir().pathAppended(value.toString()); + const FilePath valuePath = FilePath::fromString(value.toString()); const QFileInfo orgFileInfo = orgFilePath.toFileInfo(); toRename.emplace_back(std::make_tuple(node, orgFilePath, newFilePath)); @@ -309,12 +310,13 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol case QMessageBox::Yes: for (Node * const n : candidateNodes) { QString targetFilePath = orgFileInfo.absolutePath() + '/' - + newFilePath.completeBaseName(); + + valuePath.parentDir().path() + '/' + + valuePath.completeBaseName(); const QString suffix = n->filePath().suffix(); if (!suffix.isEmpty()) targetFilePath.append('.').append(suffix); toRename.emplace_back(std::make_tuple(n, n->filePath(), - FilePath::fromString(targetFilePath))); + FilePath::fromString(targetFilePath).cleanPath())); } break; case QMessageBox::Cancel: