Hybrid application with GUI or console user interface
-
Hello,
I like to develop a QT application that can be used both with console or with GUI interface, whatever the user wants. To switch between both option, I plan to provide a command-line argument.My problem is, that the application always opens a console window, when the project file contains the option
@CONFIG += console@
but I do not want to see a console window in GUI mode. On the other hand, when I disable that option, then the application does not write anything to stdout and stderr, even when I start it from a cmd shell.How can I show and hide the console window at runtime instead of using the project file config?
-
Not a direct answer to your question, but another look at you problem. Maybe better is to divide program at three parts:
backend (something which contains all logic but does not contain any interface at all)
GUI frontend
console frontend
Frontend and backend can interact via any IPC you want. In this case you will not have one executable with arguments, but you will have two executables. Maybe it is also appliable for you?
-
Yes, splitting the application into backend and two different frontends is an option but only if my idea is not possible.
The user should be able to start the program as a windows service, a linux daemon or in interactive GUI mode without needing to install anything (just unpack a ZIP file and click on the executable file).
-
Then maybe add one more part - loader? Which will ask user what he wants and will run needed frontend.