status-desktop/ui/imports/shared/controls/CopyToClipBoardButton.qml

49 lines
900 B
QML
Raw Normal View History

import QtQuick 2.13
import StatusQ.Controls 0.1
import shared.stores 1.0
import utils 1.0
StatusRoundButton {
id: copyToClipboardButton
property var onClick: function() {}
property string textToCopy: ""
property bool tooltipUnder: false
property var store
icon.name: "copy"
onPressed: {
if (!toolTip.visible) {
toolTip.visible = true
}
}
onClicked: {
if (textToCopy) {
store.copyToClipboard(textToCopy)
}
onClick()
}
StatusToolTip {
id: toolTip
2021-02-18 16:36:05 +00:00
//% "Copied!"
text: qsTrId("copied-")
orientation: tooltipUnder ? StatusToolTip.Orientation.Bottom: StatusToolTip.Orientation.Top
}
Timer {
id: hideTimer
2021-01-13 15:10:42 +00:00
interval: 2000
running: toolTip.visible
onTriggered: {
toolTip.visible = false;
}
}
}