Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Bug: TableView doesn't set key.accepted on Key_Up or Key_Down
QtWS25 Last Chance

Bug: TableView doesn't set key.accepted on Key_Up or Key_Down

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 863 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cscooper
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fxam
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cscooper
        wrote on last edited by
        #3

        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 ...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved