diff options
Diffstat (limited to 'examples/webenginewidgets/simplebrowser/main.cpp')
-rw-r--r-- | examples/webenginewidgets/simplebrowser/main.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/examples/webenginewidgets/simplebrowser/main.cpp b/examples/webenginewidgets/simplebrowser/main.cpp index 93dfc8a8c..9b9bf80b5 100644 --- a/examples/webenginewidgets/simplebrowser/main.cpp +++ b/examples/webenginewidgets/simplebrowser/main.cpp @@ -1,12 +1,22 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are @@ -44,12 +54,14 @@ #include <QApplication> #include <QWebEngineSettings> -QUrl getCommandLineUrlArgument() +QUrl commandLineUrlArgument() { const QStringList args = QCoreApplication::arguments(); - if (args.count() > 1) - return QUrl::fromUserInput(args.last()); - return QUrl(); + for (const QString &arg : args.mid(1)) { + if (!arg.startsWith(QLatin1Char('-'))) + return QUrl::fromUserInput(arg); + } + return QUrl(QStringLiteral("https://www.qt.io")); } int main(int argc, char **argv) @@ -62,9 +74,7 @@ int main(int argc, char **argv) QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PluginsEnabled, true); - QUrl url = getCommandLineUrlArgument(); - if (!url.isValid()) - url = QStringLiteral("https://www.qt.io"); + QUrl url = commandLineUrlArgument(); Browser browser; BrowserWindow *window = browser.createWindow(); |