Utils: Skip roundtrip through QUrl in FileCrumbLabel

Change-Id: I4796070ef2a3bb0b4d778c5b0db224574dbf4823
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-12-13 08:35:55 +01:00
parent dbaade3b47
commit 89403daf4e

View File

@@ -6,9 +6,6 @@
#include "filepath.h"
#include "hostosinfo.h"
#include <QDir>
#include <QUrl>
namespace Utils {
FileCrumbLabel::FileCrumbLabel(QWidget *parent)
@@ -16,17 +13,15 @@ FileCrumbLabel::FileCrumbLabel(QWidget *parent)
{
setTextFormat(Qt::RichText);
setWordWrap(true);
connect(this, &QLabel::linkActivated, this, [this](const QString &url) {
emit pathClicked(FilePath::fromUrl(QUrl(url)));
connect(this, &QLabel::linkActivated, this, [this](const QString &filePath) {
emit pathClicked(FilePath::fromString(filePath));
});
setPath(FilePath());
}
static QString linkForPath(const FilePath &path, const QString &display)
{
return "<a href=\""
+ path.toUrl().toString(QUrl::FullyEncoded) + "\">"
+ display + "</a>";
return "<a href=\"" + path.toFSPathString() + "\">" + display + "</a>";
}
void FileCrumbLabel::setPath(const FilePath &path)