Don't assume QDockWidgetGroupWindow has toolbars
As part of 3d99f90b50ab22ef5ab4433c57f9ee584a0a7cae we added logic to look up the toolbar for a QMainWindowLayoutSeparatorHelper. In the case of QDockWidgetGroupWindow the logic was broken, as it was casting the layout's parentWidget(), the group window, to a QMainWindow, instead of using the group window's parent. However for QDockWidgetGroupWindow we shouldn't look for a toolbar at all, as QDockWidgetGroupWindow can't have a toolbar. Using the parent main window's toolbar is wrong, as mouse events for that window will not affect mouse events for the group window, so the bug in 3d99f90b50ab22ef5ab4433c57f9ee584a0a7cae is not triggered. Fixes: QTBUG-132952 Pick-to: 6.9 6.8 6.5 Change-Id: Ic7845254e05bc358a39f79ec7622029d90173b45 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
c7a069870a
commit
81ed068a51
@ -276,8 +276,7 @@ public:
|
||||
#if QT_CONFIG(toolbar)
|
||||
QToolBarAreaLayout *toolBarAreaLayout()
|
||||
{
|
||||
auto *mainWindow = static_cast<QMainWindow*>(parentWidget());
|
||||
return qt_mainwindow_layout(mainWindow)->toolBarAreaLayout();
|
||||
return nullptr; // QDockWidgetGroupWindow doesn't have toolbars
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -289,7 +289,7 @@ QList<int> QMainWindowLayoutSeparatorHelper<Layout>::findSeparator(const QPoint
|
||||
Layout *layout = const_cast<Layout*>(this->layout());
|
||||
#if QT_CONFIG(toolbar)
|
||||
QToolBarAreaLayout *toolBarAreaLayout = layout->toolBarAreaLayout();
|
||||
if (!toolBarAreaLayout->isEmpty()) {
|
||||
if (toolBarAreaLayout && !toolBarAreaLayout->isEmpty()) {
|
||||
// We might have a toolbar that is currently expanded, covering
|
||||
// parts of the dock area, in which case we don't want the dock
|
||||
// area layout to treat mouse events for the expanded toolbar as
|
||||
|
Loading…
x
Reference in New Issue
Block a user