]> git.sesse.net Git - vlc/commitdiff
Qt: be able to recompute the minimalWidth at anytime
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 7 Sep 2010 13:07:20 +0000 (15:07 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 7 Sep 2010 13:15:46 +0000 (15:15 +0200)
Close #3774

modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index a308ff4c73d8004093c561cfcf9552a1bdbbb4be..300bea7ad843d086a0aee1a9a8dc50d313d12abe 100644 (file)
@@ -252,8 +252,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     /* Final sizing and showing */
     setVisible( !b_hideAfterCreation );
 
-    setMinimumWidth( __MAX( controls->sizeHint().width(),
-                            menuBar()->sizeHint().width() ) + 30 );
+    computeMinimumSize();
 
     /* Switch to minimal view if needed, must be called after the show() */
     if( b_minimalView )
@@ -318,6 +317,15 @@ MainInterface::~MainInterface()
     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        *
  *****************************/
@@ -813,7 +821,10 @@ void MainInterface::toggleMinimalView( bool b_minimal )
     }
     b_minimalView = b_minimal;
     if( !b_videoFullScreen )
+    {
         setMinimalView( b_minimalView );
+        computeMinimumSize();
+    }
 
     emit minimalViewToggled( b_minimalView );
 }
index c8264c796dd7d179c32d3c5614afebba0f2b05b9..a675d87cfd5132c022894e79b7119428bd5a52b9 100644 (file)
@@ -120,6 +120,7 @@ private:
     /* */
     void setMinimalView( bool );
     void setInterfaceFullScreen( bool );
+    void computeMinimumSize();
 
     /* */
     QSettings           *settings;