diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml --- a/discover/qml/ApplicationPage.qml +++ b/discover/qml/ApplicationPage.qml @@ -171,20 +171,12 @@ Layout.fillWidth: true } - Label { + LinkLabel { Layout.topMargin: Kirigami.Units.largeSpacing Layout.fillWidth: true wrapMode: Text.WordWrap text: appInfo.application.longDescription onLinkActivated: Qt.openUrlExternally(link); - // Since Text (and Label) lack cursor-changing abilities of their own, - // as suggested by QTBUG-30804, use a MouseAra to do our dirty work. - // See comment https://bugreports.qt.io/browse/QTBUG-30804?#comment-206287 - MouseArea { - anchors.fill: parent - cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor - acceptedButtons: Qt.NoButton // Not actually accepting clicks, just changing the cursor - } } Kirigami.Heading { diff --git a/discover/qml/LinkLabel.qml b/discover/qml/LinkLabel.qml new file mode 100644 --- /dev/null +++ b/discover/qml/LinkLabel.qml @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 Dan Leinir Turthra Jensen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library/Lesser General Public License + * version 2, or (at your option) any later version, as published by the + * Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library/Lesser General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.5 +import QtQuick.Controls 2.3 + +/** + * A label which adds showing a hand cursor if there is a link being hovered in + * the text set on the label. + */ +Label { + // Since Text (and Label) lack cursor-changing abilities of their own, + // as suggested by QTBUG-30804, use a MouseAra to do our dirty work. + // See comment https://bugreports.qt.io/browse/QTBUG-30804?#comment-206287 + MouseArea { + anchors.fill: parent + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + acceptedButtons: Qt.NoButton // Not actually accepting clicks, just changing the cursor + } +} diff --git a/discover/qml/ReviewDelegate.qml b/discover/qml/ReviewDelegate.qml --- a/discover/qml/ReviewDelegate.qml +++ b/discover/qml/ReviewDelegate.qml @@ -64,7 +64,7 @@ text: usefulnessToString(usefulnessFavorable, usefulnessTotal) } - Label { + LinkLabel { visible: !item.compact Layout.alignment: Qt.AlignRight text: { diff --git a/discover/qml/UpdatesPage.qml b/discover/qml/UpdatesPage.qml --- a/discover/qml/UpdatesPage.qml +++ b/discover/qml/UpdatesPage.qml @@ -253,7 +253,7 @@ Layout.fillWidth: true implicitHeight: view.contentHeight visible: layout.extended && changelog.length>0 - Label { + LinkLabel { id: view anchors { right: parent.right diff --git a/discover/resources.qrc b/discover/resources.qrc --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -33,6 +33,7 @@ qml/Shadow.qml qml/DiscoverPopup.qml qml/AboutPage.qml + qml/LinkLabel.qml qml/navigation.js