2020-06-29 15:23:28 +00:00
|
|
|
import QtQuick 2.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
2020-06-29 15:23:28 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
StatusRoundButton {
|
2020-06-29 15:23:28 +00:00
|
|
|
id: copyToClipboardButton
|
2022-03-15 19:34:28 +00:00
|
|
|
|
2020-06-29 15:23:28 +00:00
|
|
|
property var onClick: function() {}
|
2020-07-09 15:19:10 +00:00
|
|
|
property string textToCopy: ""
|
2021-03-25 19:37:55 +00:00
|
|
|
property bool tooltipUnder: false
|
2022-01-28 08:19:49 +00:00
|
|
|
property var store
|
2020-06-29 15:23:28 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
icon.name: "copy"
|
2021-02-18 19:07:23 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
onPressed: {
|
|
|
|
if (!toolTip.visible) {
|
|
|
|
toolTip.visible = true
|
2021-02-18 19:07:23 +00:00
|
|
|
}
|
2020-06-29 15:23:28 +00:00
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
onClicked: {
|
|
|
|
if (textToCopy) {
|
|
|
|
store.copyToClipboard(textToCopy)
|
2020-07-09 15:19:10 +00:00
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
onClick()
|
2020-06-29 15:23:28 +00:00
|
|
|
}
|
2021-01-12 14:56:17 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
StatusToolTip {
|
2021-01-12 14:56:17 +00:00
|
|
|
id: toolTip
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Copied!")
|
2022-03-15 19:34:28 +00:00
|
|
|
orientation: tooltipUnder ? StatusToolTip.Orientation.Bottom: StatusToolTip.Orientation.Top
|
2022-09-27 21:26:26 +00:00
|
|
|
timeout: 2000
|
2021-01-12 14:56:17 +00:00
|
|
|
}
|
2020-06-29 15:23:28 +00:00
|
|
|
}
|