forked from qt-creator/qt-creator
Debugger: Change workaround for scrambled dock widget layouts
The workaround from 3d92a79a
introduces a bug by itself: When a user moves
all docks off the bottom area, the workaround will trigger as the
condition "nothing below the tool bar" is met.
This here changes the condition to toolbar.width() != mainwindow.width(),
which will trigger in the known scrambled situations (there was always
something to the right of the toolbar), but not in the situation
described above.
Task-number: QTCREATORBUG-21669
Task-number: QTCREATORBUG-21455
Change-Id: Ic2eabbe2ed07352680add4fc5e3b5f6673600479
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -372,25 +372,17 @@ void DebuggerMainWindowPrivate::fixupLayoutIfNeeded()
|
||||
{
|
||||
// Evil workaround for QTCREATORBUG-21455: In some so far unknown situation
|
||||
// the saveLayout/restoreLayout process leads to a situation where some docks
|
||||
// does not end up below the perspective toolbar even though they were there
|
||||
// do not end up below the perspective toolbar even though they were there
|
||||
// initially, leading to an awkward dock layout.
|
||||
// This here tries to detect the situation (no other dock directly below the
|
||||
// toolbar) and "corrects" that by restoring the default layout.
|
||||
const QRect toolbarRect = m_toolBarDock->geometry();
|
||||
const int targetX = toolbarRect.left();
|
||||
const int targetY = toolbarRect.bottom();
|
||||
|
||||
const QList<QDockWidget *> docks = q->dockWidgets();
|
||||
for (QDockWidget *dock : docks) {
|
||||
const QRect dockRect = dock->geometry();
|
||||
// 10 for some decoration wiggle room. Found something below? Good.
|
||||
if (targetX == dockRect.left() && qAbs(targetY - dockRect.top()) < 10)
|
||||
return;
|
||||
}
|
||||
// This here tries to detect the situation (sonmething else in the bottom
|
||||
// area is at the right of the toolbar) "corrects" that by restoring the
|
||||
// default layout.
|
||||
|
||||
if (m_toolBarDock->width() != q->width()) {
|
||||
qDebug() << "Scrambled dock layout found. Resetting it.";
|
||||
resetCurrentPerspective();
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerMainWindowPrivate::selectPerspective(Perspective *perspective)
|
||||
{
|
||||
|
Reference in New Issue
Block a user