PDA

View Full Version : How to control the behaviour of the Tab-key in QTreeView?



chiefaua
28th March 2008, 18:31
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

jpn
28th March 2008, 18:57
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.