My QML application has a lateral menu (ListView
) and based on what item the user chooses it loads a different page. My problem is that sometimes the touch input is registered but not executed until the screen recives another input (not necessarily on an element of the list) and this happens at random, at least from my initial tests. Everything else works apparently fine and I have no clue on what could be the cause. I tried to console.log() each element to confirm this behaviour and the output is in fact not displayed until a second input occours. The app also has a MouseArea
which fills the entire screen, after any touch/mouse event a timer starts and if it doesn't recive any input an "idle" page is shown after 2 minutes. At first I thought that this could somehow trap the mouse events but getting rid of it doesn't solve the issue
This is the code of the timer:
Timer {
id: timerStandby
interval: 120000
triggeredOnStart: false
onTriggered: mainLoader.source = "StandbyMenu.qml"
}
}
// Fill screen to catch user input and hide cursor
MouseArea {
id: timerStandbyArea
z: 100
propagateComposedEvents: true
anchors.fill: parent
cursorShape: Qt.BlankCursor
onClicked: {
timerStandby.restart()
mouse.accepted = false;
//console.log("start timer")
testTch.visible = true
}
onPressed: {
timerStandby.restart()
mouse.accepted = false;
//console.log("start timer")
testTch.visible = true
}
onReleased: {
timerStandby.restart()
mouse.accepted = false;
//console.log("start timer")
testTch.visible = false
}
onDoubleClicked: {
timerStandby.restart()
mouse.accepted = false;
//console.log("start timer")
}
onPositionChanged: {
timerStandby.restart()
mouse.accepted = false;
//console.log("start timer")
}
onPressAndHold: {
timerStandby.restart()
mouse.accepted = false;
//console.log("start timer")
}
}
My next assumption was that my list was the issue but a simple ColumnLayout
behaves in the same way
CodePudding user response:
Using QML profiler I noticed that the OnClicked
event doesn't always return the released()
signal. As a temporary solution I've decided to use onPressed
for that particular list, still not sure why this happens though