mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:37:29 +02:00
Merge pull request #8168 from jherico/qml_window_signal
Allow scripts to receive a visibility changed signal from their windows
This commit is contained in:
commit
ae54399177
3 changed files with 5 additions and 4 deletions
|
@ -123,6 +123,7 @@ void QmlWindowClass::initQml(QVariantMap properties) {
|
||||||
|
|
||||||
// Forward messages received from QML on to the script
|
// Forward messages received from QML on to the script
|
||||||
connect(_qmlWindow, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection);
|
connect(_qmlWindow, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection);
|
||||||
|
connect(_qmlWindow, SIGNAL(visibleChanged()), this, SIGNAL(visibleChanged()), Qt::QueuedConnection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Q_ASSERT(_qmlWindow);
|
Q_ASSERT(_qmlWindow);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class QmlWindowClass : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(glm::vec2 position READ getPosition WRITE setPosition NOTIFY positionChanged)
|
Q_PROPERTY(glm::vec2 position READ getPosition WRITE setPosition NOTIFY positionChanged)
|
||||||
Q_PROPERTY(glm::vec2 size READ getSize WRITE setSize NOTIFY sizeChanged)
|
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:
|
public:
|
||||||
static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine);
|
static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine);
|
||||||
|
@ -52,7 +52,7 @@ public slots:
|
||||||
void sendToQml(const QVariant& message);
|
void sendToQml(const QVariant& message);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void visibilityChanged(bool visible); // Tool window
|
void visibleChanged();
|
||||||
void positionChanged();
|
void positionChanged();
|
||||||
void sizeChanged();
|
void sizeChanged();
|
||||||
void moved(glm::vec2 position);
|
void moved(glm::vec2 position);
|
||||||
|
|
|
@ -111,8 +111,8 @@ EntityListTool = function(opts) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
webView.visibilityChanged.connect(function (visible) {
|
webView.visibleChanged.connect(function () {
|
||||||
if (visible) {
|
if (webView.visible) {
|
||||||
that.sendUpdate();
|
that.sendUpdate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue