mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Fix window height reported by Window.geometryChanged() signal
This commit is contained in:
parent
9dcef996c5
commit
63603ff97c
2 changed files with 11 additions and 1 deletions
|
@ -51,7 +51,7 @@ WindowScriptingInterface::WindowScriptingInterface() {
|
|||
}
|
||||
});
|
||||
|
||||
connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::geometryChanged);
|
||||
connect(qApp->getWindow(), &MainWindow::windowGeometryChanged, this, &WindowScriptingInterface::onWindowGeometryChanged);
|
||||
}
|
||||
|
||||
WindowScriptingInterface::~WindowScriptingInterface() {
|
||||
|
@ -397,6 +397,15 @@ int WindowScriptingInterface::getY() {
|
|||
return qApp->getWindow()->y();
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::onWindowGeometryChanged(const QRect& windowGeometry) {
|
||||
auto geometry = windowGeometry;
|
||||
auto menu = qApp->getPrimaryMenu();
|
||||
if (menu) {
|
||||
geometry.setHeight(geometry.height() - menu->geometry().height());
|
||||
}
|
||||
emit geometryChanged(geometry);
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::copyToClipboard(const QString& text) {
|
||||
if (QThread::currentThread() != qApp->thread()) {
|
||||
QMetaObject::invokeMethod(this, "copyToClipboard", Q_ARG(QString, text));
|
||||
|
|
|
@ -522,6 +522,7 @@ public slots:
|
|||
void closeMessageBox(int id);
|
||||
|
||||
private slots:
|
||||
void onWindowGeometryChanged(const QRect& geometry);
|
||||
void onMessageBoxSelected(int button);
|
||||
void disconnectedFromDomain();
|
||||
|
||||
|
|
Loading…
Reference in a new issue