Bug: TableView doesn't set key.accepted on Key_Up or Key_Down
-
This seems to be the case based on my testing, and the source code "here":http://mirrors.dotsrc.org/kde-applicationdata/necessitas/ministro/android/necessitas/qt5/objects/5.104-x86/qml/QtQuick/Controls/TableView.qml confirms it. Should I enter this as a bug?
Thanks,
Chris -
What version are you using?
Qt 5.3.1 has event.accepted set to false explicitly ("TableView.qml":https://qt.gitorious.org/qt/qtquickcontrols/source/00fa1f33a86e5d1bd7ae44c4c6cfb5a7e630bb63:src/controls/TableView.qml), maybe its purpose is to allow us to intercept with our own Keys.onUpPressed? -
Yes, I'm using 5.3.1, apparently I was looking at the wrong source code. However, the correct code you linked to is problematic - the documentation for KeyEvent says "Generally, if the item acts on the key event then it should be accepted so that ancestor items do not also respond to the same event" which definitely applies in this case. So either the author of this code made a mistake (in which case they should fix it) or they have something very clever in mind where they deliberately went against the documentation (in which case they need to add a comment and also explain in the documentation what is happening.
You have an interesting suggestion - that maybe this was done deliberately so that users could also implement Keys.onUpPressed and perform some actions, but the actions I perform will be different depending on whether TableView has already acted on the keypress or not - and the only way to find that out is by TableView.onUpPressed setting event.accepted to true ...