Results 1 to 2 of 2

Thread: Tab behavior versus Arrow in QTableView

  1. #1
    Join Date
    Jan 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Tab behavior versus Arrow in QTableView

    Hi,

    I have an app that uses a QTableView to display and edit data. It work just as I'd expect every time, except when I change a cell (go into edit mode) and then hit "tab". I expect it to act like it does when I hit up or down arrow after making a change. When I hit "up-arrow" it saves the data and then highlights the cell just above the current one AND the focus remains with the QTableView.

    "Tab" is slightly different. It saves the data, highlights the cell to the right and then jumps the focus to the next widget in the tab order. Is there anyway to make it not jump the focus out of the QTableView?

    I looked in Qt Designer to see if there was a way to make the tab order jump back to tableView, but no dice. I can't just detect when it loses focus and set it back, because then every time I selected anything else on the screen it would jump back to the tableView (not what I want).

    Is there anyway to turn off the "Tab to next widget" abilities of the tableView? I believe I can turn off the "use tab to go to next cell" feature, but that isn't what I want. I want to tab to the next cell if it isn't in edit mode and stay in focus (this works perfectly) - AND I want to be able to type something to change the cell and then hit tab to move to the next cell and stay in focus.

    Thanks

  2. #2
    Join Date
    Jan 2008
    Posts
    56
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Tab behavior versus Arrow in QTableView

    Hi,

    I am not sure, if I understand correctly what you are trying to achieve, but maybe this helps:
    Have a look at http://qt.nokia.com/doc/4.6/qabstrac...itTrigger-enum

    Also, you can try to make your own version of QTableView, overload keyPressedEvent and handle the tab key there.

    Best regards,

    Rainer

Similar Threads

  1. One Model, Two Views (QTreeView and QTableView)
    By dgarrett97 in forum Newbie
    Replies: 2
    Last Post: 14th September 2009, 18:10
  2. Replies: 2
    Last Post: 7th June 2009, 10:47
  3. Replies: 3
    Last Post: 29th January 2009, 08:38
  4. QTableView in ui with model/delegate
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 6th November 2008, 23:00
  5. Multi-line messages in QTableView
    By Conel in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2006, 13:49

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.