Re: QT dialogs in a console application

Originally Posted by
anda_skoa
You could make the application instantiate a QApplication when it is run with a certain commandline switch.
Or make the distinction based on build flags at compile time.
I wrote one app in which I wanted both a GUI interface as well as a command line capability to be used for automating tasks. I decided to implement the core functionality in a shared library. I used a subdirs project, with one subproject for the lib, one for the command line version, and one for the GUI. Both command line and GUI versions used the classes/methods from the shared library, so the command line and GUI executable's were just really thin wrappers, etc.
I'm not saying that works for everyone, but in my case, I preferred that approach over a single executable that had multiple personalities.
I write the best type of code possible, code that I want to write, not code that someone tells me to write!
Bookmarks