QMainWindow: Fix unused separator widgets blocking mouse events

We need to hide separator widgets that are unused, otherwise they block
mouse events from the underlying widgets.

Pick-to: 6.2 6.3
Fixes: QTCREATORBUG-24600
Change-Id: I98c6d4860f683a861b89c4cad042bb734f590000
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Eike Ziller 2022-03-10 12:17:21 +01:00
parent d865129d9e
commit 9943cf7371
2 changed files with 9 additions and 0 deletions

View File

@ -2798,6 +2798,12 @@ QDockWidgetGroupWindow *QMainWindowLayout::createTabbedDockWindow()
void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animate)
{
// applying the state can lead to showing separator widgets, which would lead to a re-layout
// (even though the separator widgets are not really part of the layout)
// break the loop
if (isInApplyState)
return;
isInApplyState = true;
#if QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget)
QSet<QTabBar*> used = newState.dockAreaLayout.usedTabBars();
const auto groups =
@ -2820,6 +2826,7 @@ void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animat
usedSeparatorWidgets = usedSeps;
for (QWidget *sepWidget : retiredSeps) {
unusedSeparatorWidgets.append(sepWidget);
sepWidget->hide();
}
}
@ -2828,6 +2835,7 @@ void QMainWindowLayout::applyState(QMainWindowLayoutState &newState, bool animat
#endif // QT_CONFIG(dockwidget) && QT_CONFIG(tabwidget)
newState.apply(dockOptions & QMainWindow::AnimatedDocks && animate);
isInApplyState = false;
}
void QMainWindowLayout::saveState(QDataStream &stream) const

View File

@ -577,6 +577,7 @@ public:
QPointer<QDockWidgetGroupWindow> currentHoveredFloat; // set when dragging over a floating dock widget
void setCurrentHoveredFloat(QDockWidgetGroupWindow *w);
#endif
bool isInApplyState = false;
void hover(QLayoutItem *widgetItem, const QPoint &mousePos);
bool plug(QLayoutItem *widgetItem);