Hello,
I have persistent editor (QTextEdit) opened in each cell and now I would like to be able to just switch the column (I have 2 columns) when the user presses tab key.
setCurrentCell(currentRow(),1-currentColumn());
To do so, I reimplemented eventFilter in QTableWidget and I wait for tab key. There are two problems:
1) I cannot turn off TabKeyNavigation in QTableWidget
2) my code works and then it is ignored, like this: works, works, works, ignored, ignored, works, works, works, ignored, ignored, works...
The result is totally bizarre -- you get 3 times column switch, then "normal" navigation twice, then column switch x3 and so on.
I checked what event I get, and it appears I get key releases all the time, but not presses. Also, it looks like this (inside eventFilter):
( press, release, ) x 3, release, release, press, ...
How can tab key be released twice in a row without pressing?
Tab handling part of evenFilter:
if (key_event->key()==Qt::Key_Tab ||
key_event->key()==Qt::Key_Backtab)
{
if (_event
->type
()==QEvent::KeyPress) setCurrentCell(currentRow(),currentColumn()==1?0:1);
_event->accept();
return true; // event handled
}
if (key_event->key()==Qt::Key_Tab ||
key_event->key()==Qt::Key_Backtab)
{
if (_event->type()==QEvent::KeyPress)
setCurrentCell(currentRow(),currentColumn()==1?0:1);
_event->accept();
return true; // event handled
}
To copy to clipboard, switch view to plain text mode
Thank you in advance for enlightening me :-)
have a nice day, bye
Bookmarks