diff options
author | JCallicoat <jordan.callicoat@gmail.com> | 2021-01-20 06:06:57 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2021-01-20 23:37:12 +0300 |
commit | 0d3d5db87cb9710bb1ed5496ea5f0d2cd79d3a95 (patch) | |
tree | c666628714c70d61d5b7a01f928029808f2f5454 | |
parent | fa239865f27cedb67e9e99af558f8b110ce8f78c (diff) |
Fix menubar click-to-move window with Qt 5.15
Change logic in click handler in eventFilter so that
startSystemMove() is only called when there is no menubar
action under the mouse cursor (i.e., when a blank area
of the menubar is clicked).
Fixes #5925
-rw-r--r-- | src/gui/MainWindow.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index d1eb1fe17..5b3c5c9b6 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1784,9 +1784,11 @@ bool MainWindowEventFilter::eventFilter(QObject* watched, QEvent* event) if (event->type() == QEvent::MouseButtonPress) { if (watched == mainWindow->m_ui->menubar) { - mainWindow->windowHandle()->startSystemMove(); - // Continue processing events, so menus keep working. - return false; + auto* m = static_cast<QMouseEvent*>(event); + if (!mainWindow->m_ui->menubar->actionAt(m->pos())) { + mainWindow->windowHandle()->startSystemMove(); + return false; + } } else if (watched == mainWindow->m_ui->toolBar) { if (!mainWindow->m_ui->toolBar->isMovable() || mainWindow->m_ui->toolBar->cursor() != Qt::SizeAllCursor) { mainWindow->windowHandle()->startSystemMove(); |