2026-06-30 11:42:01 -03:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2026-06-24 14:50:17 +02:00
|
|
|
|
|
|
|
|
import Logos.Theme
|
|
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
|
|
signal copyText()
|
|
|
|
|
|
2026-06-30 11:42:01 -03:00
|
|
|
property string accessibleName: ""
|
|
|
|
|
property string iconSource: Qt.resolvedUrl("icons/copy.svg")
|
|
|
|
|
property bool copied: false
|
|
|
|
|
|
2026-06-24 14:50:17 +02:00
|
|
|
implicitWidth: 24
|
|
|
|
|
implicitHeight: 24
|
2026-06-30 11:42:01 -03:00
|
|
|
text: root.copied ? qsTr("Copied") : root.accessibleName
|
|
|
|
|
Accessible.name: text
|
2026-06-24 14:50:17 +02:00
|
|
|
display: AbstractButton.IconOnly
|
|
|
|
|
flat: true
|
|
|
|
|
|
|
|
|
|
icon.source: root.iconSource
|
|
|
|
|
icon.width: 24
|
|
|
|
|
icon.height: 24
|
|
|
|
|
icon.color: Theme.palette.textSecondary
|
|
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
|
iconSource = Qt.resolvedUrl("icons/copy.svg")
|
2026-06-30 11:42:01 -03:00
|
|
|
copied = false
|
2026-06-24 14:50:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
|
id: resetTimer
|
|
|
|
|
interval: 1500
|
|
|
|
|
repeat: false
|
|
|
|
|
onTriggered: root.reset()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.copyText()
|
|
|
|
|
root.iconSource = Qt.resolvedUrl("icons/checkmark.svg")
|
2026-06-30 11:42:01 -03:00
|
|
|
root.copied = true
|
2026-06-24 14:50:17 +02:00
|
|
|
resetTimer.restart()
|
|
|
|
|
}
|
|
|
|
|
}
|