Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

More QCommandLineParser options in custom webengine app



  • Hi,

    I'm making my own frontend for qtwebengine (a simplebrowser/quicknanobrowser). Currently I need to pass some startup parameters.

    This is my code

    int main(int argc, char** argv) {
      QCommandLineParser parser;
      parser.setApplicationDescription("The Browser");
      parser.addHelpOption();
      parser.addVersionOption();
      QCommandLineOption targetDirectoryOption(
          QStringList() << "i"
                        << "isolation",
          QCoreApplication::translate("main", "Isolate the browser for a certain <domain>."),
          QCoreApplication::translate("main", "domain"));
      parser.addOption(targetDirectoryOption);
      parser.process(app);
      return QApplication::exec();
    

    Now the problem starts when I try to give it extra startup parameters such as --no-sandbox or --remote-debugging-port intended for QtWebEngine. My program stops execution and gives following error:

    browser: Unknown options: remote-debugging-port, disable-features.
    

    How can I both support my startup flags but also keep using the ones intended for webengine/chromium ?


  • Lifetime Qt Champion

    Hi,

    Your code snippet is incomplete so it's impossible to reproduce your issue.

    In any case, if implemented correctly the additional parameters you pass using the parser should have no influence on the other since they should be pared first.


  • Moderators

    @Alexander-M-J said in More QCommandLineParser options in custom webengine app:

    My program stops execution and gives following error:
    browser: Unknown options: remote-debugging-port, disable-features.

    How can I both support my startup flags but also keep using the ones intended for webengine/chromium ?

    did you also provide a value for the parameter?
    https://doc.qt.io/qt-5/qtwebengine-debugging.html#qt-webengine-developer-tools


Log in to reply