mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Merge pull request #8345 from ctrlaltdavid/web-window-signals
add OverlayWebWindow resized, moved, and closed signals
This commit is contained in:
commit
193f0bbb99
5 changed files with 32 additions and 1 deletions
|
@ -39,6 +39,23 @@ Windows.ScrollingWindow {
|
||||||
// missing signal
|
// missing signal
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
signal moved(vector2d position);
|
||||||
|
signal resized(size size);
|
||||||
|
|
||||||
|
function notifyMoved() {
|
||||||
|
moved(Qt.vector2d(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
|
function notifyResized() {
|
||||||
|
resized(Qt.size(width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
onXChanged: notifyMoved();
|
||||||
|
onYChanged: notifyMoved();
|
||||||
|
|
||||||
|
onWidthChanged: notifyResized();
|
||||||
|
onHeightChanged: notifyResized();
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
width: pane.contentWidth
|
width: pane.contentWidth
|
||||||
implicitHeight: pane.scrollHeight
|
implicitHeight: pane.scrollHeight
|
||||||
|
|
|
@ -78,7 +78,10 @@ Decoration {
|
||||||
id: closeClickArea
|
id: closeClickArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: window.shown = false;
|
onClicked: {
|
||||||
|
window.shown = false;
|
||||||
|
window.windowClosed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ Fadable {
|
||||||
//
|
//
|
||||||
// Signals
|
// Signals
|
||||||
//
|
//
|
||||||
|
signal windowClosed();
|
||||||
signal windowDestroyed();
|
signal windowDestroyed();
|
||||||
signal mouseEntered();
|
signal mouseEntered();
|
||||||
signal mouseExited();
|
signal mouseExited();
|
||||||
|
|
|
@ -124,6 +124,10 @@ 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);
|
connect(_qmlWindow, SIGNAL(visibleChanged()), this, SIGNAL(visibleChanged()), Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(_qmlWindow, SIGNAL(resized(QSizeF)), this, SIGNAL(resized(QSizeF)), Qt::QueuedConnection);
|
||||||
|
connect(_qmlWindow, SIGNAL(moved(QVector2D)), this, SLOT(hasMoved(QVector2D)), Qt::QueuedConnection);
|
||||||
|
connect(_qmlWindow, SIGNAL(windowClosed()), this, SLOT(hasClosed()), Qt::QueuedConnection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Q_ASSERT(_qmlWindow);
|
Q_ASSERT(_qmlWindow);
|
||||||
|
@ -259,7 +263,12 @@ void QmlWindowClass::close() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlWindowClass::hasMoved(QVector2D position) {
|
||||||
|
emit moved(glm::vec2(position.x(), position.y()));
|
||||||
|
}
|
||||||
|
|
||||||
void QmlWindowClass::hasClosed() {
|
void QmlWindowClass::hasClosed() {
|
||||||
|
emit closed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlWindowClass::raise() {
|
void QmlWindowClass::raise() {
|
||||||
|
|
|
@ -62,6 +62,7 @@ signals:
|
||||||
void fromQml(const QVariant& message);
|
void fromQml(const QVariant& message);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
void hasMoved(QVector2D);
|
||||||
void hasClosed();
|
void hasClosed();
|
||||||
void qmlToScript(const QVariant& message);
|
void qmlToScript(const QVariant& message);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue