I am currently developing an application in which I have implemented the keyPressEvent
function.
I would like to detect when the user presses the ^
(caret, usually Shift + 6
on a US Keyboard) key, for which I cannot identify it from the names of the keys provided by Qt (Qt::Key_
).
Is the key available for detection? If not, how can I implement its detection?
Just override the key event like this:
.h
:
public:
MainWindow(QWidget *parent = nullptr);
void keyPressEvent(QKeyEvent *e);
~MainWindow();
.cpp
:
void MainWindow::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_AsciiCircum)
{
qDebug() << "yep !";
}
}