diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 7e3388c440b..64d2c8962d4 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -3340,8 +3340,11 @@ void ProjectExplorerPluginPrivate::updateRecentProjectMenu() if (filePath.endsWith(QLatin1String(".qws"))) continue; - const QString actionText = ActionManager::withNumberAccelerator( - filePath.withTildeHomePath(), acceleratorKey); + const QString displayPath = + filePath.osType() == OsTypeWindows ? filePath.displayName() + : filePath.withTildeHomePath(); + const QString actionText = + ActionManager::withNumberAccelerator(displayPath, acceleratorKey); QAction *action = menu->addAction(actionText); connect(action, &QAction::triggered, this, [this, filePath] { openRecentProject(filePath); diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index cac15eabdb3..156212a5041 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -335,9 +335,11 @@ public: yy += 18; // Project path. - QString pathWithTilde = projectPath.withTildeHomePath(); + const QString displayPath = + projectPath.osType() == OsTypeWindows ? projectPath.displayName() + : projectPath.withTildeHomePath(); painter->setPen(foregroundPrimaryColor); - painter->drawText(x1, yy, fm.elidedText(pathWithTilde, Qt::ElideMiddle, textSpace)); + painter->drawText(x1, yy, fm.elidedText(displayPath, Qt::ElideMiddle, textSpace)); yy += 22; } @@ -486,10 +488,12 @@ public: painter->setPen(themeColor(Theme::Welcome_ForegroundPrimaryColor)); painter->setFont(sizedFont(13, option.widget)); - QString pathWithTilde = projectPath.withTildeHomePath(); - const QString pathWithTildeElided = - painter->fontMetrics().elidedText(pathWithTilde, Qt::ElideMiddle, textSpace); - painter->drawText(x + TEXT_OFFSET_HORIZONTAL, secondBase, pathWithTildeElided); + const QString displayPath = + projectPath.osType() == OsTypeWindows ? projectPath.displayName() + : projectPath.withTildeHomePath(); + const QString displayPathElided = + painter->fontMetrics().elidedText(displayPath, Qt::ElideMiddle, textSpace); + painter->drawText(x + TEXT_OFFSET_HORIZONTAL, secondBase, displayPathElided); } QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &idx) const final