Changeset View
Changeset View
Standalone View
Standalone View
src/controls/UrlButton.qml
Show All 26 Lines | 21 | { | |||
---|---|---|---|---|---|
27 | 27 | | |||
28 | onPressed: if (mouse.button === Qt.RightButton) { | 28 | onPressed: if (mouse.button === Qt.RightButton) { | ||
29 | menu.popup() | 29 | menu.popup() | ||
30 | } | 30 | } | ||
31 | onClicked: if (mouse.button !== Qt.RightButton) { | 31 | onClicked: if (mouse.button !== Qt.RightButton) { | ||
32 | Qt.openUrlExternally(url) | 32 | Qt.openUrlExternally(url) | ||
33 | } | 33 | } | ||
34 | 34 | | |||
35 | QQC2.ToolTip { | ||||
36 | // If button's text has been overridden, show a tooltip to expose the raw URL | ||||
37 | visible: button.text != button.url && button.mouseArea.containsMouse | ||||
38 | text: url | ||||
39 | } | ||||
40 | | ||||
35 | QQC2.Menu { | 41 | QQC2.Menu { | ||
36 | id: menu | 42 | id: menu | ||
37 | QQC2.MenuItem { | 43 | QQC2.MenuItem { | ||
38 | text: qsTr("Copy link address") | 44 | text: qsTr("Copy link address") | ||
39 | onClicked: KirigamiPrivate.CopyHelperPrivate.copyTextToClipboard(button.url) | 45 | onClicked: KirigamiPrivate.CopyHelperPrivate.copyTextToClipboard(button.url) | ||
40 | } | 46 | } | ||
41 | } | 47 | } | ||
42 | } | 48 | } |