Results 1 to 2 of 2

Thread: QTreeView, ItemDelegates and Tab Key Navigation

  1. #1
    Join Date
    Jul 2010
    Location
    United States
    Posts
    13
    Qt products
    Platforms
    Unix/X11 Windows
    Thanks
    4

    Default QTreeView, ItemDelegates and Tab Key Navigation

    I have built a QTreeView with my own custom model. I have also created an item delegate to use as my input mechanism in my widget. I am coming across some strange behavior when entering text and attempting to move onto the next item. I have reimplemented keyPressEvent in my delegate to look for the Enter Key, Return Key, the up and down arrows and the tab key. I want to capture the data and then tell the tree view to move to the next item. This works fine for the enter, return and the up and down arrows. For some reason, my over-ridden keyPressEvent is never entered for the tab key. When the tab key is pressed I get an edit: editing failed message. I have tried to disable tab navigation in the QTreeView by over-riding its keyPressEvent and disabling tab navigation with setTabKeyNavigation to false but nothing is working. I don't know why my item delegate's keyPressEvent is not being called when the tab key is hit when all the other keys invoke it.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: QTreeView, ItemDelegates and Tab Key Navigation

    Can you show the relevant code?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QML screen navigation how to
    By anish in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 27th October 2013, 22:08
  2. Replies: 0
    Last Post: 29th April 2011, 10:02
  3. Replies: 0
    Last Post: 29th April 2011, 09:52
  4. Navigation purpose
    By jerkymotion in forum Qt Programming
    Replies: 6
    Last Post: 17th March 2011, 18:59
  5. Tab navigation and QListWidget
    By Arthur in forum Qt Programming
    Replies: 5
    Last Post: 9th March 2007, 20:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.