Skip to content

Commit

Permalink
Ensure the restore button of a subwindow shows up correctly (LMMS#4819)
Browse files Browse the repository at this point in the history
* SubWindow: ensure the restore button shows up correctly
* Remove old workaround for the maximize behavior on Mac
  • Loading branch information
PhysSong authored and tresf committed Feb 12, 2019
1 parent e09ff8d commit 91102a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion include/SubWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class EXPORT SubWindow : public QMdiSubWindow
QGraphicsDropShadowEffect * m_shadow;

static void elideText( QLabel *label, QString text );
bool isMaximized();
void adjustTitleBar();
};

Expand Down
22 changes: 4 additions & 18 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,6 @@ void SubWindow::elideText( QLabel *label, QString text )



bool SubWindow::isMaximized()
{
#ifdef LMMS_BUILD_APPLE
// check if subwindow size is identical to the MdiArea size, accounting for scrollbars
int hScrollBarHeight = mdiArea()->horizontalScrollBar()->isVisible() ? mdiArea()->horizontalScrollBar()->size().height() : 0;
int vScrollBarWidth = mdiArea()->verticalScrollBar()->isVisible() ? mdiArea()->verticalScrollBar()->size().width() : 0;
QSize areaSize( this->mdiArea()->size().width() - vScrollBarWidth, this->mdiArea()->size().height() - hScrollBarHeight );

return areaSize == this->size();
#else
return QMdiSubWindow::isMaximized();
#endif
}




QRect SubWindow::getTrueNormalGeometry() const
{
return m_trackedNormalGeom;
Expand Down Expand Up @@ -302,8 +285,11 @@ void SubWindow::adjustTitleBar()

void SubWindow::resizeEvent( QResizeEvent * event )
{
adjustTitleBar();
// When the parent QMdiArea gets resized, maximized subwindows also gets resized, if any.
// In that case, we should call QMdiSubWindow::resizeEvent first
// to ensure we get the correct window state.
QMdiSubWindow::resizeEvent( event );
adjustTitleBar();

// if the window was resized and ISN'T minimized/maximized/fullscreen,
// then save the current size
Expand Down

0 comments on commit 91102a5

Please sign in to comment.