Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. How to pass arguments to QWebEngine?
Qt 6.11 is out! See what's new in the release blog

How to pass arguments to QWebEngine?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 3 Posters 4.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DenjasD Offline
    DenjasD Offline
    Denjas
    wrote on last edited by
    #1

    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?

    JonBJ 1 Reply Last reply
    0
    • DenjasD Denjas

      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?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Denjas

      The --disable-logging seems to work, but some other flags doesn't seem to work, including the --ppapi-flash-path

      "--disable-logging --ppapi-flash-path=C:\Example\pepflashplayer.dll"
      

      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?

      DenjasD 1 Reply Last reply
      0
      • JonBJ JonB

        @Denjas

        The --disable-logging seems to work, but some other flags doesn't seem to work, including the --ppapi-flash-path

        "--disable-logging --ppapi-flash-path=C:\Example\pepflashplayer.dll"
        

        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?

        DenjasD Offline
        DenjasD Offline
        Denjas
        wrote on last edited by Denjas
        #3

        @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.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          juri.valdmann
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved