[vlc-devel] commit: Qt: use a QGridLayout for the core of central Widget of the main Interface. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Tue Aug 18 11:03:27 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Aug 14 18:40:00 2009 +0200| [df92fa4960bc106f9ef530af36cb8382f768f38f] | committer: Jean-Baptiste Kempf 

Qt: use a QGridLayout for the core of central Widget of the main Interface.

This will let us have a few extras widgets in the main dialog

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

 modules/gui/qt4/main_interface.cpp |   25 +++++++++++++++----------
 modules/gui/qt4/main_interface.hpp |    2 +-
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index b3e5ce6..a4f6da2 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -335,6 +335,7 @@ MainInterface::~MainInterface()
  *****************************/
 void MainInterface::recreateToolbars()
 {
+    msg_Dbg( p_intf, "Recreating the toolbars" );
     settings->beginGroup( "MainWindow" );
     delete controls;
     delete inputC;
@@ -345,9 +346,9 @@ void MainInterface::recreateToolbars()
              this, doComponentsUpdate() );
     inputC = new InputControlsWidget( p_intf, this );
 
-    mainLayout->insertWidget( 2, inputC, 0, Qt::AlignBottom );
-    mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
-                              controls, 0, Qt::AlignBottom );
+    mainLayout->addWidget( inputC, 2, 0, 1, -1, Qt::AlignBottom );
+    mainLayout->addWidget( controls, settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
+                              0, 1, -1, Qt::AlignBottom );
     settings->endGroup();
 }
 
@@ -356,7 +357,7 @@ void MainInterface::createMainWidget( QSettings *settings )
     /* Create the main Widget and the mainLayout */
     QWidget *main = new QWidget;
     setCentralWidget( main );
-    mainLayout = new QVBoxLayout( main );
+    mainLayout = new QGridLayout( main );
 
     /* Margins, spacing */
     main->setContentsMargins( 0, 0, 0, 0 );
@@ -399,11 +400,15 @@ void MainInterface::createMainWidget( QSettings *settings )
 
 
     /* Add the controls Widget to the main Widget */
-    mainLayout->insertWidget( 0, bgWidget );
-    if( videoWidget ) mainLayout->insertWidget( 0, videoWidget, 10 );
-    mainLayout->insertWidget( 2, inputC, 0, Qt::AlignBottom );
-    mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
-                              controls, 0, Qt::AlignBottom );
+    if( videoWidget ){
+        mainLayout->addWidget( videoWidget, 0, 0, 1, -1 );
+        mainLayout->setRowStretch( 0, 10 );
+    }
+    mainLayout->addWidget( bgWidget, 1, 0, 1, -1 );
+    //mainLayout->setRowStretch( 1, 10 );
+    mainLayout->addWidget( inputC, 2, 0, 1, -1, Qt::AlignBottom );
+    mainLayout->addWidget( controls, settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
+                           0, 1, -1, Qt::AlignBottom );
 
     /* Finish the sizing */
     main->updateGeometry();
@@ -839,7 +844,7 @@ void MainInterface::togglePlaylist()
         }
         else
         {
-            mainLayout->insertWidget( 4, playlistWidget );
+         //   mainLayout->insertWidget( 4, playlistWidget );
         }
         playlistVisible = true;
 
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index 34b88a3..274d4a9 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -104,7 +104,7 @@ private:
     QSystemTrayIcon     *sysTray;
     QMenu               *systrayMenu;
     QString              input_name;
-    QVBoxLayout         *mainLayout;
+    QGridLayout         *mainLayout;
     ControlsWidget      *controls;
     InputControlsWidget *inputC;
     FullscreenControllerWidget *fullscreenControls;




More information about the vlc-devel mailing list