1
0

qml: tap-on-background now removes focus, allowing convenient way to hide keyboard

This commit is contained in:
Sander van Grieken
2023-09-25 16:58:27 +02:00
parent 6222b5ad40
commit 05a34fbe24
4 changed files with 14 additions and 23 deletions

View File

@@ -298,16 +298,6 @@ ElDialog {
} }
} }
// make clicking the dialog background move the scope away from textedit fields
// so the keyboard goes away
MouseArea {
anchors.fill: parent
z: -1000
onClicked: parkFocus.focus = true
FocusScope { id: parkFocus }
}
RequestDetails { RequestDetails {
id: request id: request
wallet: Daemon.currentWallet wallet: Daemon.currentWallet

View File

@@ -1,6 +1,7 @@
import QtQuick 2.6 import QtQuick 2.15
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0
Dialog { Dialog {
id: abstractdialog id: abstractdialog
@@ -94,4 +95,11 @@ Dialog {
} }
} }
background: Rectangle {
id: bg
color: Material.dialogColor
TapHandler {
onTapped: bg.forceActiveFocus()
}
}
} }

View File

@@ -1,4 +1,4 @@
import QtQuick 2.6 import QtQuick 2.15
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
@@ -201,14 +201,4 @@ ElDialog {
} }
} }
// make clicking the dialog background move the scope away from textedit fields
// so the keyboard goes away
// TODO: here it works on desktop, but not android. hmm.
MouseArea {
anchors.fill: parent
z: -1000
onClicked: { parkFocus.focus = true }
FocusScope { id: parkFocus }
}
} }

View File

@@ -1,4 +1,4 @@
import QtQuick 2.0 import QtQuick 2.15
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
@@ -18,6 +18,9 @@ Pane {
background: Rectangle { background: Rectangle {
color: Material.dialogColor color: Material.dialogColor
TapHandler {
onTapped: root.forceActiveFocus()
}
} }
onAccept: { onAccept: {