How to pass arguments to QWebEngine?
I am trying to pass certain Command line arguments to my QWebEngineView browser. After some research it seems there is no straight-forward way to do this, but I did find you can use the "QTWEBENGINE_CHROMIUM_FLAGS" environment variable. But some of the flags I'm passing to it doesn't seem to work, I am doing it like this:
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-logging --ppapi-flash-path=C:\Example\pepflashplayer.dll");
The --disable-logging seems to work, but some other flags doesn't seem to work, including the --ppapi-flash-path. I've also tried setting the --ppapi-flash-version flag, but it still just uses whatever version is installed in the default flash directory.
I am not sure why those don't work, or if there's a better way to pass the command line arguments?
The --disable-logging seems to work, but some other flags doesn't seem to work, including the --ppapi-flash-path
I realise that path is an example, but if you have actually typed
\s and not
\\s in a C++ literal string, it won't pass the path you expect and perhaps chromium then sticks to its default directory?
@JonB I actually do have
\\in the path in my code, but that doesn't work either unfortunately.
And even if I set --ppapi-flash-version to some other version than the one I have installed, it still loads the default version even though it then shouldn't be able to load the plugin.
@Denjas Do you have spaces in the path? There's currently a bug with that as the environment variable is split on space characters without proper quoting (https://codereview.qt-project.org/243605). If you pass the arguments on the command line, without setting the environment variable, then it should be parsed correctly though.