Merge pull request from jherico/qml_window_signal

Allow scripts to receive a visibility changed signal from their windows
This commit is contained in:
Howard Stearns 2016-06-30 16:50:07 -07:00 committed by GitHub
commit ae54399177
3 changed files with 5 additions and 4 deletions
libraries/ui/src
scripts/system/libraries

View file

@ -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);

View file

@ -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);

View file

@ -111,8 +111,8 @@ EntityListTool = function(opts) {
}
});
webView.visibilityChanged.connect(function (visible) {
if (visible) {
webView.visibleChanged.connect(function () {
if (webView.visible) {
that.sendUpdate();
}
});