Hi All,

I am having some problems implementing the eventFilter for my QTableView (filled with QStandardtems).

This partially works:


Qt Code:
  1. ....
  2. //ui->playTableView->installEventFilter(this);
  3. }
  4.  
  5.  
  6. bool MainWindow::eventFilter(QObject *object, QEvent *e)
  7. {
  8. // Get selected text on keypress event ctrl+e
  9. if (object == ui->playTableView) {
  10. if (e->type() == QEvent::KeyPress) {
  11. QKeyEvent *keyEvent = static_cast<QKeyEvent*>(e);
  12. if (keyEvent->key() == Qt::Key_A) {
  13. qDebug() << "CTRL-A Key pressed" << keyEvent->key();
  14. return true;
  15. }
  16. }
  17. }
  18. return true;
  19. }
To copy to clipboard, switch view to plain text mode 

But it makes the app very slow, especially filling the QTableView up with data is like 10 times slower.

What I want to accomplish here is to capture the CTRL-A (Select ALL) keystroke as well as the Arrow Up and Arrow Down when the focus is on the QTableView Widget. I want to keep the default behavior, that all rows in the tableview are selected, but I want to disable some QLineEdits if more than on Row is selected.

If a user selects with the mouse it is not a problem, since I can capture the clicked and double clicked. But How to I catch the CTRL-A ??

Can I use QAction for this?

Hope some one can help me, if possible also with some examples.

Thanks in advace!