qml: FlatButton: show indicator for press-and-hold functionality
What changed, and why it matters
This commit adds a small visual progress bar to buttons in Electrum's mobile-style QML interface that have a hidden 'press and hold' action. It is purely a user-experience change to help users discover that long-pressing certain buttons does something extra. There is no security-relevant change in the code.
No security action needed. This is a benign UI/UX enhancement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch introduces a pressAndHoldIndicator boolean property on the FlatButton QML control. When enabled and the button is pressed, a thin rectangle animates from zero width to full width over 600 ms after a 200 ms pause, giving users visual feedback that a long-press gesture is available. The property is enabled on the Receive and Send buttons in WalletMainView.qml. No logic handling secrets, network communication, validation, or permissions is modified.
Changed components
electrum/gui/qml/components/controls/FlatButton.qmlelectrum/gui/qml/components/WalletMainView.qmlInspect captured patch +44 / −0
diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml
index 8fdbb64..55f7351 100644
--- a/electrum/gui/qml/components/WalletMainView.qml
+++ b/electrum/gui/qml/components/WalletMainView.qml
@@ -303,6 +303,7 @@ Item {
var dialog = receiveDetailsDialog.createObject(mainView)
dialog.open()
}
+ pressAndHoldIndicator: true
onPressAndHold: {
Config.userKnowsPressAndHold = true
Daemon.currentWallet.deleteExpiredRequests()
@@ -317,6 +318,7 @@ Item {
text: qsTr('Send')
enabled: !invoiceParser.busy && !piResolver.busy && !requestDetails.busy
onClicked: openSendDialog()
+ pressAndHoldIndicator: true
onPressAndHold: {
Config.userKnowsPressAndHold = true
app.stack.push(Qt.resolvedUrl('Invoices.qml'))
diff --git a/electrum/gui/qml/components/controls/FlatButton.qml b/electrum/gui/qml/components/controls/FlatButton.qml
index 621dec4..ab3f0e4 100644
--- a/electrum/gui/qml/components/controls/FlatButton.qml
+++ b/electrum/gui/qml/components/controls/FlatButton.qml
@@ -9,6 +9,7 @@ TabButton {
checkable: false
property bool textUnderIcon: true
+ property bool pressAndHoldIndicator: false
font.pixelSize: constants.fontSizeSmall
icon.width: constants.iconSizeMedium
@@ -25,4 +26,45 @@ TabButton {
font: control.font
color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.foreground
}
+
+ Rectangle {
+ id: indicator
+ anchors.top: control.top
+ anchors.horizontalCenter: control.horizontalCenter
+ width: 0
+ opacity: 0
+ height: 3
+ color: control.Material.accentColor
+
+ states: State {
+ name: 'pressing'
+ when: pressAndHoldIndicator && control.pressed
+ PropertyChanges {
+ target: indicator
+ width: control.width
+ opacity: 1
+ }
+ }
+
+ transitions: Transition {
+ to: 'pressing'
+ SequentialAnimation {
+ PauseAnimation {
+ duration: 200
+ }
+ ParallelAnimation {
+ NumberAnimation {
+ target: indicator
+ property: "width"
+ duration: 600
+ }
+ NumberAnimation {
+ target: indicator
+ property: "opacity"
+ duration: 600
+ }
+ }
+ }
+ }
+ }
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.