[vlc-commits] commit: Qt: playlist, use a better QSplitter, on Mac (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Mon Nov 29 00:05:17 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Nov 26 08:54:31 2010 +0100| [6627718ccb4fe802f5528f6644cd71d92a1f7e88] | committer: Jean-Baptiste Kempf 

Qt: playlist, use a better QSplitter, on Mac

It might be a good idea to do the same on other platforms

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

 modules/gui/qt4/components/playlist/playlist.cpp |   23 ++++++++++++++++++++++
 modules/gui/qt4/components/playlist/playlist.hpp |   20 +++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index aa17904..8f26d7e 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -415,3 +415,26 @@ QSize LocationButton::sizeHint() const
 }
 
 #undef PADDING
+
+#ifdef Q_WS_MAC
+QSplitterHandle *PlaylistWidget::createHandle()
+{
+    return new SplitterHandle( orientation(), this );
+}
+
+SplitterHandle::SplitterHandle( Qt::Orientation orientation, QSplitter * parent )
+               : QSplitterHandle( orientation, parent)
+{
+};
+
+QSize SplitterHandle::sizeHint() const
+{
+    return (orientation() == Qt::Horizontal) ? QSize( 1, height() ) : QSize( width(), 1 );
+}
+
+void SplitterHandle::paintEvent(QPaintEvent *event)
+{
+    QPainter painter(this);
+    painter.fillRect(event->rect(), QBrush(Qt::gray));
+}
+#endif /* __APPLE__ */
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index 2b02388..ff791ed 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -35,7 +35,10 @@
 //#include <vlc_playlist.h>
 
 #include <QSplitter>
+
 #include <QPushButton>
+#include <QSPlitterHandle>
+#include <QMouseEvent>
 
 class StandardPLPanel;
 class LocationBar;
@@ -68,11 +71,28 @@ protected:
     virtual void dropEvent( QDropEvent *);
     virtual void dragEnterEvent( QDragEnterEvent * );
     virtual void closeEvent( QCloseEvent * );
+#ifdef __APPLE__
+    virtual QSplitterHandle *createHandle();
+#endif
 
 private slots:
     void changeView( const QModelIndex& index );
 };
 
+#ifdef Q_WS_MAC
+class SplitterHandle : public QSplitterHandle
+{
+public:
+    SplitterHandle( Qt::Orientation orientation, QSplitter * parent );
+
+protected:
+    virtual void paintEvent ( QPaintEvent * );
+
+private:
+    virtual QSize sizeHint () const;
+};
+#endif /* __APPLE__ */
+
 class LocationButton : public QPushButton
 {
 public:



More information about the vlc-commits mailing list