components android focus workaround

This commit is contained in:
Jaquee 2017-08-08 10:37:52 +02:00
parent b6f268d3a5
commit f605793cfc
2 changed files with 17 additions and 4 deletions

View file

@ -38,6 +38,13 @@ Rectangle {
property var under: null
signal clicked()
function doClick() {
// Android workaround
releaseFocus();
clicked();
}
function getOffset() {
var offset = 0
var item = button
@ -139,7 +146,7 @@ Rectangle {
onClicked: {
if(parent.checked)
return
button.clicked()
button.doClick()
parent.checked = true
}
}

View file

@ -45,6 +45,12 @@ Item {
// Dynamic label width
Layout.minimumWidth: (label.contentWidth + 10 * scaleRatio) // (label.contentWidth > 80)? label.contentWidth + 20 : 100
function doClick() {
// Android workaround
releaseFocus();
clicked();
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
@ -98,9 +104,9 @@ Item {
MouseArea {
id: buttonArea
anchors.fill: parent
onClicked: parent.clicked()
onClicked: doClick()
}
Keys.onSpacePressed: clicked()
Keys.onReturnPressed: clicked()
Keys.onSpacePressed: doClick()
Keys.onReturnPressed: doClick()
}