mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 18:32:34 +02:00
Add URL parameter to Window.openUrl() API function
This commit is contained in:
parent
86aa3c8709
commit
64eb4d11e1
2 changed files with 11 additions and 6 deletions
|
@ -645,12 +645,16 @@ void WindowScriptingInterface::setActiveDisplayPlugin(int index) {
|
|||
qApp->setActiveDisplayPlugin(name);
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::openWebBrowser() {
|
||||
void WindowScriptingInterface::openWebBrowser(const QString& url) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "openWebBrowser", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this, "openWebBrowser", Q_ARG(const QString&, url));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
offscreenUi->load("Browser.qml");
|
||||
offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) {
|
||||
if (!url.isEmpty()) {
|
||||
newObject->setProperty("url", url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -616,10 +616,11 @@ public slots:
|
|||
void setActiveDisplayPlugin(int index);
|
||||
|
||||
/**jsdoc
|
||||
* Opens a web browser in a pop-up window.
|
||||
* Opens an Interface web browser window.
|
||||
* @function Window.openWebBrowser
|
||||
* @param {string} url="" - The URL of the web page to display.
|
||||
*/
|
||||
void openWebBrowser();
|
||||
void openWebBrowser(const QString& url = "");
|
||||
|
||||
|
||||
private slots:
|
||||
|
|
Loading…
Reference in a new issue