mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 00:23:01 +02:00
Ensure that geometryChanged is emitted after docked widget is resized
This commit is contained in:
parent
b40d5658e3
commit
083470e4fe
4 changed files with 22 additions and 1 deletions
|
@ -109,6 +109,10 @@ void InteractiveWindow::forwardKeyReleaseEvent(int key, int modifiers) {
|
|||
QCoreApplication::postEvent(QCoreApplication::instance(), event);
|
||||
}
|
||||
|
||||
void InteractiveWindow::emitMainWindowResizeEvent() {
|
||||
emit qApp->getWindow()->windowGeometryChanged(qApp->getWindow()->geometry());
|
||||
}
|
||||
|
||||
/**jsdoc
|
||||
* A set of properties used when creating an <code>InteractiveWindow</code>.
|
||||
* @typedef {object} InteractiveWindow.Properties
|
||||
|
@ -215,10 +219,11 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
|||
Qt::QueuedConnection);
|
||||
QObject::connect(rootItem, SIGNAL(keyReleaseEvent(int, int)), this, SLOT(forwardKeyReleaseEvent(int, int)),
|
||||
Qt::QueuedConnection);
|
||||
emit mainWindow->windowGeometryChanged(qApp->getWindow()->geometry());
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(_dockWidget.get(), SIGNAL(onResizeEvent()), this, SLOT(emitMainWindowResizeEvent()));
|
||||
|
||||
_dockWidget->setSource(QUrl(sourceUrl));
|
||||
mainWindow->addDockWidget(dockArea, _dockWidget.get());
|
||||
} else {
|
||||
|
|
|
@ -319,6 +319,7 @@ protected slots:
|
|||
|
||||
void forwardKeyPressEvent(int key, int modifiers);
|
||||
void forwardKeyReleaseEvent(int key, int modifiers);
|
||||
void emitMainWindowResizeEvent();
|
||||
|
||||
private:
|
||||
std::shared_ptr<QmlWindowProxy> _qmlWindowProxy;
|
||||
|
|
|
@ -47,3 +47,10 @@ QQuickItem* DockWidget::getRootItem() const {
|
|||
std::shared_ptr<QQuickView> DockWidget::getQuickView() const {
|
||||
return _quickView;
|
||||
}
|
||||
|
||||
void DockWidget::resizeEvent(QResizeEvent* event) {
|
||||
// This signal is currently handled in `InteractiveWindow.cpp`. There, it's used to
|
||||
// emit a `windowGeometryChanged()` signal, which is handled by scripts
|
||||
// that need to know when to change the position of their overlay UI elements.
|
||||
emit onResizeEvent();
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
class QQuickView;
|
||||
class QQuickItem;
|
||||
class DockWidget : public QDockWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DockWidget(const QString& title, QWidget* parent = nullptr);
|
||||
~DockWidget() = default;
|
||||
|
@ -26,6 +27,13 @@ public:
|
|||
void setSource(const QUrl& url);
|
||||
QQuickItem* getRootItem() const;
|
||||
std::shared_ptr<QQuickView> getQuickView() const;
|
||||
|
||||
signals:
|
||||
void onResizeEvent();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<QQuickView> _quickView;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue