[vlc-devel] commit: Qt: selector cosmetic polish (Jakob Leben )
git version control
git at videolan.org
Wed Feb 10 07:22:33 CET 2010
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Wed Feb 10 07:21:12 2010 +0100| [347bfe4d1235057e5f0007a886b218d71f795eb2] | committer: Jakob Leben
Qt: selector cosmetic polish
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=347bfe4d1235057e5f0007a886b218d71f795eb2
---
modules/gui/qt4/components/playlist/selector.cpp | 20 +++++++++++++++++---
modules/gui/qt4/components/playlist/selector.hpp | 12 +++++++++++-
modules/gui/qt4/util/customwidgets.hpp | 4 ++--
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index 7af9b34..f0ce539 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -44,6 +44,20 @@
#include <vlc_playlist.h>
#include <vlc_services_discovery.h>
+void SelectorActionButton::paintEvent( QPaintEvent *event )
+{
+ QPainter p( this );
+ QColor color = palette().color( QPalette::HighlightedText );
+ color.setAlpha( 80 );
+ if( underMouse() )
+ p.fillRect( rect(), color );
+ p.setPen( color );
+ int frame = style()->pixelMetric( QStyle::PM_DefaultFrameWidth, 0, this );
+ p.drawLine( rect().topLeft() + QPoint( 0, frame ),
+ rect().bottomLeft() - QPoint( 0, frame ) );
+ QVLCFramelessButton::paintEvent( event );
+}
+
PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text )
: qitem(i), lblAction( NULL)
{
@@ -74,14 +88,14 @@ void PLSelItem::addAction( ItemAction act, const QString& tooltip )
icon = QIcon( ":/buttons/playlist/playlist_remove" ); break;
}
- lblAction = new QVLCFramelessButton();
+ lblAction = new SelectorActionButton();
lblAction->setIcon( icon );
+ lblAction->setMinimumWidth( lblAction->sizeHint().width() + 6 );
if( !tooltip.isEmpty() ) lblAction->setToolTip( tooltip );
layout->addWidget( lblAction, 0 );
lblAction->hide();
- layout->addSpacing( 3 );
CONNECT( lblAction, clicked(), this, triggerAction() );
}
@@ -102,7 +116,7 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
setFrameStyle( QFrame::NoFrame );
viewport()->setAutoFillBackground( false );
setIconSize( QSize( 24,24 ) );
- setIndentation( 14 );
+ setIndentation( 12 );
header()->hide();
setRootIsDecorated( true );
setAlternatingRowColors( false );
diff --git a/modules/gui/qt4/components/playlist/selector.hpp b/modules/gui/qt4/components/playlist/selector.hpp
index ab3c503..e9ea017 100644
--- a/modules/gui/qt4/components/playlist/selector.hpp
+++ b/modules/gui/qt4/components/playlist/selector.hpp
@@ -36,13 +36,13 @@
#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
+#include "util/customwidgets.hpp"
#include <vlc_playlist.h>
#include "qt4.hpp"
class PlaylistWidget;
-class QVLCFramelessButton;
enum SelectorItemType {
CATEGORY_TYPE,
@@ -71,6 +71,16 @@ enum ItemAction {
RM_ACTION
};
+
+class SelectorActionButton : public QVLCFramelessButton
+{
+public:
+ SelectorActionButton( QWidget *parent = NULL )
+ : QVLCFramelessButton( parent ) {}
+private:
+ void paintEvent( QPaintEvent * );
+};
+
class PLSelItem : public QWidget
{
Q_OBJECT;
diff --git a/modules/gui/qt4/util/customwidgets.hpp b/modules/gui/qt4/util/customwidgets.hpp
index b7d843a..77d5765 100644
--- a/modules/gui/qt4/util/customwidgets.hpp
+++ b/modules/gui/qt4/util/customwidgets.hpp
@@ -63,8 +63,8 @@ class QVLCFramelessButton : public QPushButton
public:
QVLCFramelessButton( QWidget *parent = NULL );
QSize sizeHint() const;
-private:
- void paintEvent( QPaintEvent * event );
+protected:
+ virtual void paintEvent( QPaintEvent * event );
};
class QLabel;
More information about the vlc-devel
mailing list