mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:43:21 +02:00
Merge pull request #4502 from huffman/webwindow-open-url
Add more functionality to WebWindow (get/set url, raise)
This commit is contained in:
commit
f075674415
3 changed files with 25 additions and 0 deletions
|
@ -338,7 +338,11 @@ var toolBar = (function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
||||||
|
if (marketplaceWindow.url != MARKETPLACE_URL) {
|
||||||
|
marketplaceWindow.setURL(MARKETPLACE_URL);
|
||||||
|
}
|
||||||
marketplaceWindow.setVisible(true);
|
marketplaceWindow.setVisible(true);
|
||||||
|
marketplaceWindow.raise();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,6 +1147,10 @@ PropertiesTool = function(opts) {
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update();
|
selectionManager._update();
|
||||||
|
} else if (data.type = "showMarketplace") {
|
||||||
|
if (marketplaceWindow.url != data.url) {
|
||||||
|
marketplaceWindow.setURL(data.url);
|
||||||
|
}
|
||||||
} else if (data.type == "action") {
|
} else if (data.type == "action") {
|
||||||
if (data.action == "moveSelectionToGrid") {
|
if (data.action == "moveSelectionToGrid") {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
||||||
_windowWidget = dockWidget;
|
_windowWidget = dockWidget;
|
||||||
} else {
|
} else {
|
||||||
_windowWidget = new QWidget(Application::getInstance()->getWindow(), Qt::Window);
|
_windowWidget = new QWidget(Application::getInstance()->getWindow(), Qt::Window);
|
||||||
|
_windowWidget->setWindowTitle(title);
|
||||||
_windowWidget->setMinimumSize(width, height);
|
_windowWidget->setMinimumSize(width, height);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(_windowWidget);
|
auto layout = new QVBoxLayout(_windowWidget);
|
||||||
|
@ -96,6 +97,18 @@ void WebWindowClass::setVisible(bool visible) {
|
||||||
QMetaObject::invokeMethod(_windowWidget, "setVisible", Qt::BlockingQueuedConnection, Q_ARG(bool, visible));
|
QMetaObject::invokeMethod(_windowWidget, "setVisible", Qt::BlockingQueuedConnection, Q_ARG(bool, visible));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebWindowClass::setURL(const QString& url) {
|
||||||
|
if (QThread::currentThread() != thread()) {
|
||||||
|
QMetaObject::invokeMethod(this, "setURL", Qt::BlockingQueuedConnection, Q_ARG(QString, url));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_webView->setUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebWindowClass::raise() {
|
||||||
|
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::BlockingQueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
QScriptValue WebWindowClass::constructor(QScriptContext* context, QScriptEngine* engine) {
|
QScriptValue WebWindowClass::constructor(QScriptContext* context, QScriptEngine* engine) {
|
||||||
WebWindowClass* retVal;
|
WebWindowClass* retVal;
|
||||||
QString file = context->argument(0).toString();
|
QString file = context->argument(0).toString();
|
||||||
|
|
|
@ -34,6 +34,7 @@ signals:
|
||||||
class WebWindowClass : public QObject {
|
class WebWindowClass : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QObject* eventBridge READ getEventBridge)
|
Q_PROPERTY(QObject* eventBridge READ getEventBridge)
|
||||||
|
Q_PROPERTY(QString url READ getURL)
|
||||||
public:
|
public:
|
||||||
WebWindowClass(const QString& title, const QString& url, int width, int height, bool isToolWindow = false);
|
WebWindowClass(const QString& title, const QString& url, int width, int height, bool isToolWindow = false);
|
||||||
~WebWindowClass();
|
~WebWindowClass();
|
||||||
|
@ -42,6 +43,9 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
QString getURL() const { return _webView->url().url(); }
|
||||||
|
void setURL(const QString& url);
|
||||||
|
void raise();
|
||||||
ScriptEventBridge* getEventBridge() const { return _eventBridge; }
|
ScriptEventBridge* getEventBridge() const { return _eventBridge; }
|
||||||
void addEventBridgeToWindowObject();
|
void addEventBridgeToWindowObject();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue