qml : Keys.onPressed does not work but Keys.onReleased works fine inside FocusScope.Please help me in fixing the issue.
Unsolved
QML and Qt Quick
-
Hey everyone, I'm having an issue with keyPress events in lListView written inside FocusScope
Keys.onReleased works but Keys.onPressed does not work.
In fact, not even Keys.onUpPressed is not working. Please help me in fixing this.Thanks in advance.
-
Hey everyone, I'm having an issue with keyPress events in lListView written inside FocusScope
Keys.onReleased works but Keys.onPressed does not work.
In fact, not even Keys.onUpPressed is not working. Please help me in fixing this.Thanks in advance.
@Sudo007
show some code pls -
import QtQuick 2.2 FocusScope { id:mainPage signal somethingWasClicked(var sender, var arguments) function createSpyFunction(object) { return function() { somethingWasClicked(object, arguments) } } function crawlChildren(obj) { if (obj.Keys.onPressed) { Object.defineProperty(obj, '__clickedFunction', { value: createSpyFunction(obj) }) obj.Keys.onPressed.connect(obj.__clickedFunction) } if (obj.children) { for (var i = 0; i < obj.children.length; i++) { crawlChildren(obj.children[i]) } } } Component.onCompleted: { mainPage.crawlChildren(screenBG) } Rectangle{ id: screenBG anchors.fill: parent Keys.onPressed: { console.log("#onPressed#") switch(event.key) { case Qt.Key_Up:// not working console.log('onPressed##Key_Up was pressed') break case Qt.Key_Down: // only down key event is triggred console.log('onPressed##Key_Down was pressed') break } } } Rectangle { z: 99999 anchors.fill: parent color: "black" } } // There is child screen ( qml page having List View ). for which down key event works but not up key // // Display the configured users as a vertical list of 'menubutton' items, one per user. // /// usr.qml ListView{ id: userList width: parent.width anchors.top: usersCountBar.bottom anchors.bottom: parent.bottom focus: true clip: true // .. }