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 DISPLAY
command first to stop displaying the new window, but theunset DISPLAY
command 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 -
@jiaming
As @mrjj has said, the cleanest way to do this is to copy the parent's environment variables excludingDISPLAY
to the environment for the child process. If you don't want to do that, if you are under Linux you may find runningQProcess
commandenv DISPLAY= <your-command>
(note the spacing,DISPLAY=
is an argument of its own) does the job (test from command line first).