Files
purple-electrumwallet/electrum/gui/qml/components/controls/ElDialog.qml
T
Sander van Grieken e7cc2c5a63 Revert "qml: pressing "Esc" on desktop to ~simulate "back" button"
This reverts commit 7f7ee8d82f.

This commit caused a regression with the android back button not closing a dialog.

reproduce:
1. from the main window, press receive.
2. in the request details window, press Create request.
3. in the receive payment dialog, press Copy
4. observe dialog cannot be closed by back button
2023-03-23 10:12:10 +01:00

77 lines
2.0 KiB
QML

import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.3
Dialog {
id: abstractdialog
property bool allowClose: true
property string iconSource
function doClose() {
close()
}
parent: Overlay.overlay
modal: true
Overlay.modal: Rectangle {
color: "#aa000000"
}
closePolicy: allowClose
? Popup.CloseOnEscape | Popup.CloseOnPressOutside
: Popup.NoAutoClose
onOpenedChanged: {
if (opened) {
app.activeDialogs.push(abstractdialog)
} else {
if (app.activeDialogs.indexOf(abstractdialog) < 0) {
console.log('dialog should exist in activeDialogs!')
app.activeDialogs.pop()
return
}
app.activeDialogs.splice(app.activeDialogs.indexOf(abstractdialog),1)
}
}
header: ColumnLayout {
spacing: 0
RowLayout {
spacing: 0
Image {
visible: iconSource
source: iconSource
Layout.preferredWidth: constants.iconSizeXLarge
Layout.preferredHeight: constants.iconSizeXLarge
Layout.leftMargin: constants.paddingMedium
Layout.topMargin: constants.paddingMedium
Layout.bottomMargin: constants.paddingMedium
}
Label {
text: title
elide: Label.ElideRight
Layout.fillWidth: true
leftPadding: constants.paddingXLarge
topPadding: constants.paddingXLarge
bottomPadding: constants.paddingXLarge
rightPadding: constants.paddingXLarge
font.bold: true
font.pixelSize: constants.fontSizeMedium
}
}
Rectangle {
Layout.fillWidth: true
Layout.leftMargin: constants.paddingXXSmall
Layout.rightMargin: constants.paddingXXSmall
height: 1
color: Qt.rgba(0,0,0,0.5)
}
}
}