Is the "?" keyboard input intercepted by Qt?
-
I have a simple QMainWindow app which I use to process keyboard events.
I have something very similar to this code cut-down version:
@
MainWindow::keyPressEvent(QKeyEvent *event)
{
qDebug() << "Key: " << event->key() << ", " << event->text() << endl;
}
@So, if I press "/" key and then release I get two events (one for the press and one for the release).
If I press SHIFT and then "a" and then release "a" and then release SHIFT I get 4 events (two presses and two releases).However, my issue is that when I try to get a questionmark ("?") by pressing SHIFT and then pressing "/" (in UK keyboard the slash key is shared with questionmark) and then release both. I get two events only, one for the SHIFT press and one for the SHIFT release.
This is the only key that I know of that I can't get, it appears that question mark seems to be intercepted by Qt and therefore I don't get the keypress.
Can anyone explain this? Is it possible to get the "?" to work with Qt?
Thanks,
Fodder -
something like that:
@
if(event->type() == QEvent::KeyPress)
{
QKeyEvent keyEvent = static_cast<QKeyEvent>(event);qDebug() << "modifier" << keyEvent->nativeModifiers(); if(keyEvent->key() == Qt::Key_Slash && (QApplication::keyboardModifiers() == Qt::ShiftModifier)) { qDebug() << "key press" << keyEvent->key(); }
}
...
@