mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 17:13:31 +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
|
||||
connect(_qmlWindow, SIGNAL(sendToScript(QVariant)), this, SLOT(qmlToScript(const QVariant&)), Qt::QueuedConnection);
|
||||
connect(_qmlWindow, SIGNAL(visibleChanged()), this, SIGNAL(visibleChanged()), Qt::QueuedConnection);
|
||||
});
|
||||
}
|
||||
Q_ASSERT(_qmlWindow);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -111,8 +111,8 @@ EntityListTool = function(opts) {
|
|||
}
|
||||
});
|
||||
|
||||
webView.visibilityChanged.connect(function (visible) {
|
||||
if (visible) {
|
||||
webView.visibleChanged.connect(function () {
|
||||
if (webView.visible) {
|
||||
that.sendUpdate();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue