Merge pull request #8345 from ctrlaltdavid/web-window-signals

add OverlayWebWindow resized, moved, and closed signals
This commit is contained in:
Brad Hefta-Gaub 2016-08-02 18:41:49 -07:00 committed by GitHub
commit 193f0bbb99
5 changed files with 32 additions and 1 deletions

View file

@ -39,6 +39,23 @@ Windows.ScrollingWindow {
// missing signal
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 {
width: pane.contentWidth
implicitHeight: pane.scrollHeight

View file

@ -78,7 +78,10 @@ Decoration {
id: closeClickArea
anchors.fill: parent
hoverEnabled: true
onClicked: window.shown = false;
onClicked: {
window.shown = false;
window.windowClosed();
}
}
}
}

View file

@ -30,6 +30,7 @@ Fadable {
//
// Signals
//
signal windowClosed();
signal windowDestroyed();
signal mouseEntered();
signal mouseExited();

View file

@ -124,6 +124,10 @@ 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);
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);
@ -259,7 +263,12 @@ void QmlWindowClass::close() {
}
}
void QmlWindowClass::hasMoved(QVector2D position) {
emit moved(glm::vec2(position.x(), position.y()));
}
void QmlWindowClass::hasClosed() {
emit closed();
}
void QmlWindowClass::raise() {

View file

@ -62,6 +62,7 @@ signals:
void fromQml(const QVariant& message);
protected slots:
void hasMoved(QVector2D);
void hasClosed();
void qmlToScript(const QVariant& message);