Get rid of QWS option
My application has different processes doing different job.
There is a Main Process, who acts as a parent process and that creates all the child process.
The reason for being child process is that, it is optional for the system. These options are configurable.
One of the child process is "Qt UI". For the complete system, display unit becomes optional. So the UI goes optional.
Having this as a overview,
Qt application runs in a child process. Since it a child process, it has no "main". main() function is in the parent process. And the entry point of the Qt process would be some function. Example "StartUI()". This function will be spawned as a child process.
So, since there is no main for Qt UI, cannot get the command line argument for QWS server.
Also the parent process example "./MainApplication" cannot take the option "-qws" because it doesnt makes sense for the main application to take such argument.
So having said as a scenario, I would like to manipulate or compute the QWS server options inside my code and pass to QApplication. Is there any way?
I read about QApplication::GuiServer option for QApplication. But for some reason that doesn't work.
Please let me know if you know any way.
Is your MainApplication a daemon ? Or should it be the main QWS server also ?
@SGaist The MainApplication is not a Qt application. It is a parent process does few job of creating multiple child process.
So, since it is not a Qt application, it doesn't makes sense to pass "-qws" to it.
That's were I tried to manage "QWS" inside the code.
Yesterday after posting this question, I have worked some more and got it working.
Solution looks simple. But I dont know the consequences yet.
While creating QApplication object, I pass "QApplication::GUIServer" to it.
And just pass a dummy "argc" and "argv" to it.
So far it works good. But, have not tested extensively.