Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,16 @@ void SubWindow::changeEvent( QEvent *event )

void SubWindow::setVisible(bool visible)
{
if (isDetached())
if (isDetached() || visible)
{
// When detached, top-level window is the child widget itself. (This is janky and is best changed at some point.)
// For that reason we forward show/hide to the child widget, and don't touch the hidden attached window frame.
widget()->setVisible(visible);
}
else
if (!isDetached())
{
// When attached, visibility of the actual window is controlled by SubWindow.
// SubWindow::hide() when it's already hidden still causes a size recalculation,
// if the child widget is hidden it does not get included into the layout, and maximum size is set to 0x0.
// There shouldn't be a reason to keep the child widget hidden when the subwindow is attached.
// see bug #8292
widget()->show();
// Nevertheless, the subwindow contents still need to be visible, which is addressed above.
QMdiSubWindow::setVisible(visible);
}
}
Expand Down Expand Up @@ -617,10 +613,6 @@ bool SubWindow::eventFilter(QObject* obj, QEvent* event)

switch (event->type())
{
case QEvent::WindowStateChange:
event->accept();
return true;

case QEvent::Close:
if (isDetached())
{
Expand Down Expand Up @@ -649,6 +641,15 @@ bool SubWindow::eventFilter(QObject* obj, QEvent* event)
hide();
}
return QMdiSubWindow::eventFilter(obj, event);

case QEvent::Hide:
layout()->setSizeConstraint(QLayout::SetNoConstraint);
return QMdiSubWindow::eventFilter(obj, event);

case QEvent::Show:
layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);
resize(widget()->size().addMargins(decorationMargins())); // manually sync the sizes again
return QMdiSubWindow::eventFilter(obj, event);

default:
return QMdiSubWindow::eventFilter(obj, event);
Expand Down
Loading