From 43a53ea7a26cb9d79e626476a665c594c86fa65a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 17 Oct 2024 15:09:48 +0200 Subject: [PATCH] QmlDesigner: Enable links in descriptions Task-number: QDS-13773 Change-Id: Ie36dee2ab6c962487489d544cb596a389554641d Reviewed-by: Knud Dollereder (cherry picked from commit 82150e2cee8726ca8fb19c360c16328e34506065) Reviewed-by: Tim Jenssen --- .../qmldesigner/welcomepage/ThumbnailDelegate.qml | 12 ++++++++++++ src/plugins/studiowelcome/studiowelcomeplugin.cpp | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/share/qtcreator/qmldesigner/welcomepage/ThumbnailDelegate.qml b/share/qtcreator/qmldesigner/welcomepage/ThumbnailDelegate.qml index d50627d05e9..3d918328bf0 100644 --- a/share/qtcreator/qmldesigner/welcomepage/ThumbnailDelegate.qml +++ b/share/qtcreator/qmldesigner/welcomepage/ThumbnailDelegate.qml @@ -382,6 +382,7 @@ Item { Text { id: recentProjectInfo color: Constants.currentGlobalText + linkColor: Constants.currentBrand text: typeof(description) === "undefined" ? "" : description anchors.fill: parent font.pixelSize: 12 @@ -390,6 +391,17 @@ Item { wrapMode: Text.WordWrap anchors.margins: Constants.thumbnailMargin anchors.topMargin: 25 + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + cursorShape: recentProjectInfo.hoveredLink === "" ? Qt.ArrowCursor : Qt.PointingHandCursor + } + + Connections { + target: recentProjectInfo + onLinkActivated: (link)=> Constants.projectModel.showLink(link) + } } TagArea { diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 68e8deb8277..7878ba1c963 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -273,6 +273,11 @@ public: QUrl("qthelp://org.qt-project.qtdesignstudio/doc/studio-getting-started.html")); } + Q_INVOKABLE void showLink(const QString &link) + { + QDesktopServices::openUrl(QUrl::fromUserInput(link)); + } + Q_INVOKABLE void openExample(const QString &examplePath, const QString &exampleName, const QString &formFile,