2023-03-30 12:51:14 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.stores 1.0
|
|
|
|
|
|
|
|
StatusIcon {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
required property string textToCopy
|
|
|
|
|
2024-02-07 14:56:45 +00:00
|
|
|
readonly property bool hovered: mouseArea.containsMouse
|
|
|
|
|
2023-03-30 12:51:14 +00:00
|
|
|
icon: "copy"
|
|
|
|
color: mouseArea.containsMouse? Theme.palette.primaryColor1 : Theme.palette.baseColor1
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
root.icon = "copy"
|
|
|
|
root.color = Qt.binding(function(){ return mouseArea.containsMouse? Theme.palette.primaryColor1 : Theme.palette.baseColor1 })
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
onClicked: {
|
|
|
|
RootStore.copyToClipboard(root.textToCopy)
|
|
|
|
root.icon = "tiny/checkmark"
|
|
|
|
root.color = Theme.palette.successColor1
|
|
|
|
|
|
|
|
Backpressure.debounce(root, 1500, function () {
|
|
|
|
root.reset()
|
|
|
|
})()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|