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