waynew
2nd May 2010, 17:24
I need to add some custom action when the user presses the Enter key while the QTableView has focus, like when the user saves a cell edit.
Don't think a shortcut is good because the normal key behavior will get overridden.
I can see an event function in the inherited members list for QTableView, but when I try this:
bool QTableView::event(QEvent *event)
{
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return)
{
etc
The compile error is no 'bool QTableView::event(QEvent*)' member function declared in class 'QTableView'
Any advice on how to do this?
Don't think a shortcut is good because the normal key behavior will get overridden.
I can see an event function in the inherited members list for QTableView, but when I try this:
bool QTableView::event(QEvent *event)
{
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return)
{
etc
The compile error is no 'bool QTableView::event(QEvent*)' member function declared in class 'QTableView'
Any advice on how to do this?