[vlc-commits] Qt: playlist: pad zoom slider (fixes #5291)

Francois Cartegnie git at videolan.org
Wed Sep 7 14:38:35 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep  7 14:37:49 2011 +0200| [8d3b932e39c621359f2a77c3841fe4f33e5ae5a9] | committer: Francois Cartegnie

Qt: playlist: pad zoom slider (fixes #5291)

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

 modules/gui/qt4/components/playlist/playlist.cpp   |   13 ++++++++++++-
 .../gui/qt4/components/playlist/standardpanel.cpp  |    7 +++++++
 .../gui/qt4/components/playlist/standardpanel.hpp  |    1 +
 3 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index a299878..147e867 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -41,6 +41,8 @@
 #include <QMenu>
 #include <QSignalMapper>
 #include <QSlider>
+#include <QSpacerItem>
+#include <QList>
 
 /**********************************************************************
  * Playlist Widget. The embedded playlist
@@ -187,7 +189,16 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     zoomSlider->setValue( model->getZoom() );
     CONNECT( zoomSlider, valueChanged( int ), model, changeZoom( int ) );
 
-    layout->addWidget( zoomSlider, 1, 3, ( Qt::AlignBottom | Qt::AlignRight ) );
+    /* pad our zoom slider */
+    QGridLayout *sliderLayout = new QGridLayout( this );
+    QSpacerItem* sliderSpacer =
+            new QSpacerItem( mainView->getScrollBarsSize(),
+                             mainView->getScrollBarsSize(),
+                            QSizePolicy::Fixed, QSizePolicy::Fixed );
+    sliderLayout->addWidget( zoomSlider, 0, 0, Qt::AlignCenter );
+    sliderLayout->addItem( sliderSpacer, 1, 1, Qt::AlignCenter );
+
+    layout->addLayout( sliderLayout, 1, 3, ( Qt::AlignBottom | Qt::AlignRight ) );
 
     setAcceptDrops( true );
     setWindowTitle( qtr( "Playlist" ) );
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 76d7e25..63612eb 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -48,6 +48,7 @@
 #include <QStackedLayout>
 #include <QSignalMapper>
 #include <QSettings>
+#include <QScrollBar>
 
 #include <assert.h>
 
@@ -411,6 +412,12 @@ int StandardPLPanel::currentViewIndex() const
         return PICTUREFLOW_VIEW;
 }
 
+int StandardPLPanel::getScrollBarsSize() const
+{
+    /* FIXME: should return a set in case of different widths */
+    return currentView->verticalScrollBar()->sizeHint().width();
+}
+
 void StandardPLPanel::cycleViews()
 {
     if( currentView == iconView )
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 6b936a0..9857051 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -69,6 +69,7 @@ public:
            VIEW_COUNT };
 
     int currentViewIndex() const;
+    int getScrollBarsSize() const;
 
 protected:
     PLModel *model;



More information about the vlc-commits mailing list