开发者

Signal and slots for Qt console application?

开发者 https://www.devze.com 2023-01-13 08:50 出处:网络
I wonder if I should use signal and slot开发者_开发百科s with my own console object? Or are they only used with a GUI?You can use signals and slots in a console application. You can subclass QCoreAppl

I wonder if I should use signal and slot开发者_开发百科s with my own console object? Or are they only used with a GUI?


You can use signals and slots in a console application. You can subclass QCoreApplication or just use one as an event loop. In main(), create a QCoreApplication object along with any of your own objects that use signals and slots, connect the signals and then call .exec() on the QCoreApplication object. Make sure you have some way to signal the QCoreApplication to quit.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号