From 1f451269cd7b67bd94554a21f85830fefd92e546 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 30 Jun 2016 13:22:01 -0700 Subject: [PATCH 1/2] Allow scripts to receive a visibility changed signal from their windows --- libraries/ui/src/QmlWindowClass.cpp | 1 + libraries/ui/src/QmlWindowClass.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/ui/src/QmlWindowClass.cpp b/libraries/ui/src/QmlWindowClass.cpp index c0eba4abf3..7d56e51495 100644 --- a/libraries/ui/src/QmlWindowClass.cpp +++ b/libraries/ui/src/QmlWindowClass.cpp @@ -123,6 +123,7 @@ void QmlWindowClass::initQml(QVariantMap properties) { // Forward messages received from QML on to the script connect(_qmlWindow, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection); + connect(_qmlWindow, SIGNAL(visibleChanged()), this, SIGNAL(visibleChanged()), Qt::QueuedConnection); }); } Q_ASSERT(_qmlWindow); diff --git a/libraries/ui/src/QmlWindowClass.h b/libraries/ui/src/QmlWindowClass.h index e1865b133a..c30027df6e 100644 --- a/libraries/ui/src/QmlWindowClass.h +++ b/libraries/ui/src/QmlWindowClass.h @@ -24,7 +24,7 @@ class QmlWindowClass : public QObject { Q_OBJECT Q_PROPERTY(glm::vec2 position READ getPosition WRITE setPosition NOTIFY positionChanged) Q_PROPERTY(glm::vec2 size READ getSize WRITE setSize NOTIFY sizeChanged) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) public: static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine); @@ -52,7 +52,7 @@ public slots: void sendToQml(const QVariant& message); signals: - void visibilityChanged(bool visible); // Tool window + void visibleChanged(); void positionChanged(); void sizeChanged(); void moved(glm::vec2 position); From dfb6cb1aa340f04d4116efc8c621fa3d08f08aca Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 30 Jun 2016 14:25:36 -0700 Subject: [PATCH 2/2] Updating entity list --- scripts/system/libraries/entityList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system/libraries/entityList.js b/scripts/system/libraries/entityList.js index e9baeac86c..448293a2ac 100644 --- a/scripts/system/libraries/entityList.js +++ b/scripts/system/libraries/entityList.js @@ -111,8 +111,8 @@ EntityListTool = function(opts) { } }); - webView.visibilityChanged.connect(function (visible) { - if (visible) { + webView.visibleChanged.connect(function () { + if (webView.visible) { that.sendUpdate(); } });