- Qt 5 and OpenCV 4 Computer Vision Projects
- Zhuo Qingliang
- 148字
- 2021-06-24 13:59:17
The Exit action
Take Exit action as an example. If users click it from the File menu, a signal named triggered will be emitted. So, let's connect this signal to a slot of our application instance in the MainWindow class's member function, createActions:
connect(exitAction, SIGNAL(triggered(bool)), QApplication::instance(), SLOT(quit()));
The connect method takes four parameters: the signal sender, the signal, the receiver, and the slot. Once the connection is made, the slot on the receiver will be called as soon as the signal of the sender is emitted. Here, we connect the triggered signal of the Exit action with the quit slot of the application instance to enable the application to exit when we click on the Exit action.
Now, to compile and run, click the Exit item from the File menu. The application will exit as we expect if everything goes well.
- Mastering JavaScript Functional Programming
- PHP 從入門到項目實踐(超值版)
- 我的第一本算法書
- RabbitMQ Cookbook
- Learning Probabilistic Graphical Models in R
- JavaScript腳本特效編程給力起飛
- JBoss:Developer's Guide
- RubyMotion iOS Develoment Essentials
- Web前端開發技術:HTML、CSS、JavaScript
- Akka入門與實踐
- Scrapy網絡爬蟲實戰
- Mastering XenApp?
- 深入大型數據集:并行與分布化Python代碼
- 鋁合金陽極氧化與表面處理技術(第三版)
- Python Business Intelligence Cookbook