Is there a similar "unset DISPLAY" setting method in QT, that is, the program is not allowed to display any new windows
-
When I start a program with qprocess, it will pop up a new window. If I start the program in terminal, I can enter the
unset DISPLAYcommand first to stop displaying the new window, but theunset DISPLAYcommand doesn't seem to work in QT. The QT version is 5.12 -
Hi
What did you try to use "unset"
Something like this ?
https://doc.qt.io/qt-5/qprocess.html#setProcessEnvironment -
When I start a program with qprocess, it will pop up a new window. If I start the program in terminal, I can enter the
unset DISPLAYcommand first to stop displaying the new window, but theunset DISPLAYcommand doesn't seem to work in QT. The QT version is 5.12@jiaming
As @mrjj has said, the cleanest way to do this is to copy the parent's environment variables excludingDISPLAYto the environment for the child process. If you don't want to do that, if you are under Linux you may find runningQProcesscommandenv DISPLAY= <your-command>(note the spacing,DISPLAY=is an argument of its own) does the job (test from command line first). -
Hi
What did you try to use "unset"
Something like this ?
https://doc.qt.io/qt-5/qprocess.html#setProcessEnvironment