Hi Everyone,
To see how various keys behave in the context of Qt when pressed and released, I added 2 VIRTUAL FUNCTIONS to my MainWindow Class and implemented them in the following way:
void MainWindow
::keyPressEvent ( QKeyEvent * event
) {
qDebug("Came here,,,, Key Pressed");
}
void MainWindow
::keyReleaseEvent(QKeyEvent *event
) {
qDebug("Came here,,,, Key Released");
}
void MainWindow::keyPressEvent ( QKeyEvent * event )
{
qDebug("Came here,,,, Key Pressed");
}
void MainWindow::keyReleaseEvent(QKeyEvent *event)
{
qDebug("Came here,,,, Key Released");
}
To copy to clipboard, switch view to plain text mode
What I observed is that, whenever I pressed any key, I would get both the qDebug statements as expected. But in the case of following four keys, I get only the qDebug of the keyReleaseEvent method:
Tab key, LeftArrow key, RightArrow key, SpaceBar
That means, for these keys only release event happens. I am really confused
. Can anyone please explain why it is so?
With Regards,
Sattu
Bookmarks