How do I catch a tilde keypress with Qt?
void MainWindow
::keyPressEvent(QKeyEvent *event
) {
switch(event->key())
{
case Qt::Key_?????:
{
//do something...
} break;
default: break;
}
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
switch(event->key())
{
case Qt::Key_?????:
{
//do something...
} break;
default: break;
}
}
To copy to clipboard, switch view to plain text mode
Qt defines 5 different Tilde keys (for accented charactors), and I can't find the right one I'm supposed to use.
The five are:
Qt::Key_AsciiTilde (I tried it, and can't seem to catch it)
Qt::Key_Atilde (These are for accented charactors - Didn't try them)
Qt::Key_Ntilde
Qt::Key_Otilde
Qt::Key_Dead_Tilde (Not sure what this is, but tried it, couldn't catch it).
Other keys work (I can catch Qt::Key_Escape), so I didn't mess up with the code itself. How do I catch the tilde key (the key under the Escape key on standard US Qwerty keyboards)?
Bookmarks