Signal and slots for Qt console application?
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.
精彩评论