Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the maximization of sub windows #7530

Merged
23 changes: 23 additions & 0 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ SubWindow::SubWindow(QWidget *parent, Qt::WindowFlags windowFlags) :
*/
void SubWindow::paintEvent( QPaintEvent * )
{
// Don't paint any of the other stuff if the sub window is maximized
JohannesLorenz marked this conversation as resolved.
Show resolved Hide resolved
// so that only it child content is painted.
if (isMaximized())
michaelgregorius marked this conversation as resolved.
Show resolved Hide resolved
{
return;
}

QPainter p( this );
QRect rect( 0, 0, width(), m_titleBarHeight );

Expand Down Expand Up @@ -295,9 +302,25 @@ void SubWindow::moveEvent( QMoveEvent * event )
*/
void SubWindow::adjustTitleBar()
{
// Don't show the title or any button if the sub window is maximized. Otherwise they
// might show up behind the actual maximized content of the child widget.
if (isMaximized())
{
m_closeBtn->hide();
m_maximizeBtn->hide();
m_restoreBtn->hide();
m_windowTitle->hide();

return;
JohannesLorenz marked this conversation as resolved.
Show resolved Hide resolved
}

// Title adjustments
m_windowTitle->show();

// button adjustments
m_maximizeBtn->hide();
JohannesLorenz marked this conversation as resolved.
Show resolved Hide resolved
m_restoreBtn->hide();
m_closeBtn->show();

const int rightSpace = 3;
const int buttonGap = 1;
Expand Down