[vlc-commits] commit: Qt: be able to recompute the minimalWidth at anytime ( Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Tue Sep 7 15:16:11 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Sep  7 15:07:20 2010 +0200| [6e14c048289103e081ec214f51b929fe69ea254b] | committer: Jean-Baptiste Kempf 

Qt: be able to recompute the minimalWidth at anytime

Close #3774

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6e14c048289103e081ec214f51b929fe69ea254b
---

 modules/gui/qt4/main_interface.cpp |   15 +++++++++++++--
 modules/gui/qt4/main_interface.hpp |    1 +
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index a308ff4..300bea7 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -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 );
 }
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index c8264c7..a675d87 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -120,6 +120,7 @@ private:
     /* */
     void setMinimalView( bool );
     void setInterfaceFullScreen( bool );
+    void computeMinimumSize();
 
     /* */
     QSettings           *settings;



More information about the vlc-commits mailing list