Commit 6e14c048 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: be able to recompute the minimalWidth at anytime

Close #3774
parent f2c03da6
...@@ -252,8 +252,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -252,8 +252,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* Final sizing and showing */ /* Final sizing and showing */
setVisible( !b_hideAfterCreation ); setVisible( !b_hideAfterCreation );
setMinimumWidth( __MAX( controls->sizeHint().width(), computeMinimumSize();
menuBar()->sizeHint().width() ) + 30 );
/* Switch to minimal view if needed, must be called after the show() */ /* Switch to minimal view if needed, must be called after the show() */
if( b_minimalView ) if( b_minimalView )
...@@ -318,6 +317,15 @@ MainInterface::~MainInterface() ...@@ -318,6 +317,15 @@ MainInterface::~MainInterface()
p_intf->p_sys->p_mi = NULL; p_intf->p_sys->p_mi = NULL;
} }
void MainInterface::computeMinimumSize()
{
int minWidth = 30;
if( menuBar()->isVisible() )
minWidth += __MAX( controls->sizeHint().width(), menuBar()->sizeHint().width() );
setMinimumWidth( minWidth );
}
/***************************** /*****************************
* Main UI handling * * Main UI handling *
*****************************/ *****************************/
...@@ -813,7 +821,10 @@ void MainInterface::toggleMinimalView( bool b_minimal ) ...@@ -813,7 +821,10 @@ void MainInterface::toggleMinimalView( bool b_minimal )
} }
b_minimalView = b_minimal; b_minimalView = b_minimal;
if( !b_videoFullScreen ) if( !b_videoFullScreen )
{
setMinimalView( b_minimalView ); setMinimalView( b_minimalView );
computeMinimumSize();
}
emit minimalViewToggled( b_minimalView ); emit minimalViewToggled( b_minimalView );
} }
......
...@@ -120,6 +120,7 @@ private: ...@@ -120,6 +120,7 @@ private:
/* */ /* */
void setMinimalView( bool ); void setMinimalView( bool );
void setInterfaceFullScreen( bool ); void setInterfaceFullScreen( bool );
void computeMinimumSize();
/* */ /* */
QSettings *settings; QSettings *settings;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment