View Full Version : Alt+f4 combination in windows application
Kaluss
20th August 2012, 14:33
Hello Guys,
I got small problem with my app.
What I should do to capture "alt+f4" event and assign to it my own acction.
I use QMainWindow class.
I will be gratefull 4 any tips.
spirit
20th August 2012, 14:38
You should reimplement QWidget::closeEvent.
Kaluss
20th August 2012, 14:48
Thanks it works fine !
Kaluss
20th August 2012, 20:35
But now I have another problem:
<code>
void QWidget::closeEvent(QCloseEvent *event)
{
event->ignore();
}
</code>
How can I now gain access to action from my own QMainWindow ?
Is there any simple way ?
spirit
20th August 2012, 20:58
Didn't get what an action do you mean.
Kaluss
20th August 2012, 21:15
In my own main window when someone click on close option, it will start action which display new QDialog window with question like "Do u really want to quit?" Yes|No
spirit
20th August 2012, 21:27
See Main window example (http://qt-project.org/doc/qt-4.8/mainwindows-application-mainwindow-cpp.html). Especially how MainWindow::closeEvent works.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.