Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

[SOLVED] Intercepting Tab key press to manage focus switching manually

$
0
0
I want to intercept Tab key press in my main window to prevent Qt from switching focus. Here’s what I’ve tried so far: bool CMainWindow::event(QEvent * e) {     if (e && e->type() == QEvent::KeyPress)     {         QKeyEvent * keyEvent = dynamic_cast<QKeyEvent*>(e);         if (keyEvent && keyEvent->key() == Qt::Key_Tab)             return true;     }     return QMainWindow::event(e); } This doesn’t work, event isn’t called when I press Tab. neither do keyPressEvent and eventFilter. How to achieve what I want?

Viewing all articles
Browse latest Browse all 13965

Trending Articles