Results 1 to 2 of 2

Thread: How to control the behaviour of the Tab-key in QTreeView?

  1. #1
    Join Date
    Mar 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How to control the behaviour of the Tab-key in QTreeView?

    Hello

    I have a view displaying some columns of data. Some of these columns is editable, some aren't.
    When I press the Tab-key while editing an item in the view, the view jumps to another item in the view to edit it. In my case, that's always the item in the first column of the next row. That's not what I want, I would like the view to jump to the next item to the right, and only jump to the next row if there are no more editable items in a row.
    How can I change this behaviour of the QTreeView?

    Thanks in advance,
    Thomas

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to control the behaviour of the Tab-key in QTreeView?

    QWidget::focusNextPrevChild(), QWidget::keyPressEvent() and/or QAbstractItemView::moveCursor() are the methods to play with. Notice that all of them are virtual methods. Take a look at src/gui/itemviews/qabstractitemview.cpp for hints and reimplement one or more of them to do what you want.
    J-P Nurmi

Similar Threads

  1. Replies: 6
    Last Post: 3rd February 2006, 09:48

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.