The easiest way might be to reimplement QAbstractItemView::focusNextPrevChild():
bool MyTableWidget::focusNextPrevChild(bool next)
{
// check if current column is the editable column
int currentColumn = currentItem() ? currentItem->column() : -1;
if (tabKeyNavigation() && currentColumn == 3)
{
// Qt::Key_Down instead of Qt::Key_Tab and Qt::Key_Up instead of Qt::Key_Backtab
QKeyEvent event
(QEvent::KeyPress, next ? Qt
::Key_Down : Qt
::Key_Up, Qt
::NoModifier);
keyPressEvent(&event);
if (event.isAccepted())
return true;
}
}
bool MyTableWidget::focusNextPrevChild(bool next)
{
// check if current column is the editable column
int currentColumn = currentItem() ? currentItem->column() : -1;
if (tabKeyNavigation() && currentColumn == 3)
{
// Qt::Key_Down instead of Qt::Key_Tab and Qt::Key_Up instead of Qt::Key_Backtab
QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Down : Qt::Key_Up, Qt::NoModifier);
keyPressEvent(&event);
if (event.isAccepted())
return true;
}
return QTableWidget::focusNextPrevChild(next);
}
To copy to clipboard, switch view to plain text mode
Bookmarks