Commit 347bfe4d authored by Jakob Leben's avatar Jakob Leben

Qt: selector cosmetic polish

parent af688c8f
...@@ -44,6 +44,20 @@ ...@@ -44,6 +44,20 @@
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_services_discovery.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 ) PLSelItem::PLSelItem ( QTreeWidgetItem *i, const QString& text )
: qitem(i), lblAction( NULL) : qitem(i), lblAction( NULL)
{ {
...@@ -74,14 +88,14 @@ void PLSelItem::addAction( ItemAction act, const QString& tooltip ) ...@@ -74,14 +88,14 @@ void PLSelItem::addAction( ItemAction act, const QString& tooltip )
icon = QIcon( ":/buttons/playlist/playlist_remove" ); break; icon = QIcon( ":/buttons/playlist/playlist_remove" ); break;
} }
lblAction = new QVLCFramelessButton(); lblAction = new SelectorActionButton();
lblAction->setIcon( icon ); lblAction->setIcon( icon );
lblAction->setMinimumWidth( lblAction->sizeHint().width() + 6 );
if( !tooltip.isEmpty() ) lblAction->setToolTip( tooltip ); if( !tooltip.isEmpty() ) lblAction->setToolTip( tooltip );
layout->addWidget( lblAction, 0 ); layout->addWidget( lblAction, 0 );
lblAction->hide(); lblAction->hide();
layout->addSpacing( 3 );
CONNECT( lblAction, clicked(), this, triggerAction() ); CONNECT( lblAction, clicked(), this, triggerAction() );
} }
...@@ -102,7 +116,7 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf ) ...@@ -102,7 +116,7 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
setFrameStyle( QFrame::NoFrame ); setFrameStyle( QFrame::NoFrame );
viewport()->setAutoFillBackground( false ); viewport()->setAutoFillBackground( false );
setIconSize( QSize( 24,24 ) ); setIconSize( QSize( 24,24 ) );
setIndentation( 14 ); setIndentation( 12 );
header()->hide(); header()->hide();
setRootIsDecorated( true ); setRootIsDecorated( true );
setAlternatingRowColors( false ); setAlternatingRowColors( false );
......
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
#include <QPushButton> #include <QPushButton>
#include <QLabel> #include <QLabel>
#include <QHBoxLayout> #include <QHBoxLayout>
#include "util/customwidgets.hpp"
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include "qt4.hpp" #include "qt4.hpp"
class PlaylistWidget; class PlaylistWidget;
class QVLCFramelessButton;
enum SelectorItemType { enum SelectorItemType {
CATEGORY_TYPE, CATEGORY_TYPE,
...@@ -71,6 +71,16 @@ enum ItemAction { ...@@ -71,6 +71,16 @@ enum ItemAction {
RM_ACTION RM_ACTION
}; };
class SelectorActionButton : public QVLCFramelessButton
{
public:
SelectorActionButton( QWidget *parent = NULL )
: QVLCFramelessButton( parent ) {}
private:
void paintEvent( QPaintEvent * );
};
class PLSelItem : public QWidget class PLSelItem : public QWidget
{ {
Q_OBJECT; Q_OBJECT;
......
...@@ -63,8 +63,8 @@ class QVLCFramelessButton : public QPushButton ...@@ -63,8 +63,8 @@ class QVLCFramelessButton : public QPushButton
public: public:
QVLCFramelessButton( QWidget *parent = NULL ); QVLCFramelessButton( QWidget *parent = NULL );
QSize sizeHint() const; QSize sizeHint() const;
private: protected:
void paintEvent( QPaintEvent * event ); virtual void paintEvent( QPaintEvent * event );
}; };
class QLabel; class QLabel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment