History

Add URL parameter to Window.openUrl() API function

David Rowe committed 6 years ago

Commit 64eb4d11 parent 86aa3c82 files · +11 −6Browse files

Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/scripting/WindowScriptingInterface.cpp+8−4
@@ -645,12 +645,16 @@ void WindowScriptingInterface::setActiveDisplayPlugin(int index) { · 644 unmodified lines
645 qApp->setActiveDisplayPlugin(name);645 qApp->setActiveDisplayPlugin(name);
646}646}
647 647
648void WindowScriptingInterface::openWebBrowser() {648void WindowScriptingInterface::openWebBrowser(const QString& url) {
649 if (QThread::currentThread() != thread()) {649 if (QThread::currentThread() != thread()) {
650 QMetaObject::invokeMethod(this, "openWebBrowser", Qt::QueuedConnection);650 QMetaObject::invokeMethod(this, "openWebBrowser", Q_ARG(const QString&, url));
651 return;651 return;
652 }652 }
653 653
654 auto offscreenUi = DependencyManager::get<OffscreenUi>();654 auto offscreenUi = DependencyManager::get<OffscreenUi>();
655 offscreenUi->load("Browser.qml");655 offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
656 if (!url.isEmpty()) {
657 newObject->setProperty("url", url);
658 }
659 });
656}660}