This commit is contained in:
staked-smart-ace 2021-01-13 19:10:42 +04:00 committed by Iuri Matias
parent 3f63ded1b2
commit 858c041671
2 changed files with 8 additions and 18 deletions

View File

@ -22,7 +22,6 @@ ModalPopup {
anchors.leftMargin: Style.current.smallPadding anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter: linkText.verticalCenter anchors.verticalCenter: linkText.verticalCenter
textToCopy: popup.getStatusText.substr(popup.getStatusText.indexOf("https")) textToCopy: popup.getStatusText.substr(popup.getStatusText.indexOf("https"))
textTooltip: qsTr('Copied "%1" to clipboard').arg(popup.getStatusText.substr(popup.getStatusText.indexOf("https")))
} }
} }

View File

@ -1,6 +1,7 @@
import QtQuick 2.13 import QtQuick 2.13
import QtQuick.Controls 2.13 import QtQuick.Controls 2.13
import "../imports" import "../imports"
import "../shared/status"
Rectangle { Rectangle {
id: copyToClipboardButton id: copyToClipboardButton
@ -10,8 +11,6 @@ Rectangle {
color: Style.current.transparent color: Style.current.transparent
property var onClick: function() {} property var onClick: function() {}
property string textToCopy: "" property string textToCopy: ""
property bool showTooltip: false
property string textTooltip: ""
Image { Image {
width: 20 width: 20
@ -35,7 +34,9 @@ Rectangle {
} }
onPressed: { onPressed: {
parent.color = Style.current.grey parent.color = Style.current.grey
parent.showTooltip = true if (!toolTip.visible) {
toolTip.visible = true
}
} }
onReleased: { onReleased: {
parent.color = Style.current.grey parent.color = Style.current.grey
@ -48,28 +49,18 @@ Rectangle {
} }
} }
ToolTip { StatusToolTip {
id: toolTip id: toolTip
text: parent.textTooltip width: 80
parent: copyToClipboardButton text: qsTr("Copied!")
}
Timer {
id:showTimer
interval: 300
running: parent.showTooltip && !toolTip.visible
onTriggered: {
toolTip.visible = true;
}
} }
Timer { Timer {
id:hideTimer id:hideTimer
interval: 2500 interval: 2000
running: toolTip.visible running: toolTip.visible
onTriggered: { onTriggered: {
toolTip.visible = false; toolTip.visible = false;
parent.showTooltip = false;
} }
} }
} }