Added tooltip when copy invite URL to clipboard
This commit is contained in:
parent
8afcacfa6a
commit
2f2b06fb5e
|
@ -21,7 +21,8 @@ ModalPopup {
|
|||
anchors.left: linkText.right
|
||||
anchors.leftMargin: Style.current.smallPadding
|
||||
anchors.verticalCenter: linkText.verticalCenter
|
||||
textToCopy: popup.getStatusText
|
||||
textToCopy: popup.getStatusText.substr(popup.getStatusText.indexOf("https"))
|
||||
textTooltip: "Copied \"" + popup.getStatusText.substr(popup.getStatusText.indexOf("https")) + "\" to clipboard"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ Rectangle {
|
|||
color: Style.current.transparent
|
||||
property var onClick: function() {}
|
||||
property string textToCopy: ""
|
||||
property bool showTooltip: false
|
||||
property string textTooltip: ""
|
||||
|
||||
Image {
|
||||
width: 20
|
||||
|
@ -32,10 +34,11 @@ Rectangle {
|
|||
parent.color = Style.current.grey
|
||||
}
|
||||
onPressed: {
|
||||
parent.color = Style.current.darkGrey
|
||||
parent.color = Style.current.grey
|
||||
parent.showTooltip = true
|
||||
}
|
||||
onReleased: {
|
||||
parent.color = Style.current.transparent
|
||||
parent.color = Style.current.grey
|
||||
}
|
||||
onClicked: {
|
||||
if (textToCopy) {
|
||||
|
@ -44,6 +47,31 @@ Rectangle {
|
|||
onClick()
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip {
|
||||
id: toolTip
|
||||
text: parent.textTooltip
|
||||
parent: copyToClipboardButton
|
||||
}
|
||||
|
||||
Timer {
|
||||
id:showTimer
|
||||
interval: 500
|
||||
running: parent.showTooltip && !toolTip.visible
|
||||
onTriggered: {
|
||||
toolTip.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id:hideTimer
|
||||
interval: 1500
|
||||
running: toolTip.visible
|
||||
onTriggered: {
|
||||
toolTip.visible = false;
|
||||
parent.showTooltip = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue