I have a QTableView that displays a custom model. I would like to right-click so that I can open the contextual drop-down menu in the following tabular data:
MainWindow::MainWindow() { QTableView * itsView = new QTableView; itsView->installEventFilter(this); ... //Add other widgets and display them all } bool MainWindow::eventFilter(QObject * watched, QEvent * event) { if(event->type() == QEvent::MouseButtonPress) printf("MouseButtonPress event!\n"); else if(event->type() == QEvent::KeyPress) printf("KeyPress event!\n"); }
Oddly enough, I get all KeyPress events properly: when I select a cell and press a key, I get a "KeyPress!" Event. message. However, I only get the MouseButtonPress event! when I click on a very thin border around the whole table.
user-interface qt qt4
rcv
source share