I press the Ctrl key. My first function works fine:
void MainWindow::keyPressEvent(QKeyEvent *event){
if(event->modifiers()==Qt::CTRL){ //RETURNS TRUE
ui->widget->groupmaking=true;
} }
In the second, i have troubles with checking what kind of key was released. (It was Ctrl)
void MainWindow::keyReleaseEvent(QKeyEvent *event){
if(event->modifiers()==Qt::CTRL){ //RETURNS FALSE. WHY?
ui->widget->groupmaking=false;
ui->widget->groupexist=true;
}
}
So, how to catch Ctrl release correctly ?