1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-15 13:32:35 +02:00

* Added setOpacity method to ClickableLabel.

This commit is contained in:
Christian Muehlhaeuser 2014-08-20 08:22:42 +02:00
parent acbb8c5df8
commit 9c01ae995f
2 changed files with 11 additions and 1 deletions

View File

@ -28,6 +28,7 @@ ClickableLabel::ClickableLabel( QWidget* parent )
: QLabel( parent )
, m_pressed( false )
, m_moved( false )
, m_opacity( 0.5 )
{
setCursor( Qt::PointingHandCursor );
}
@ -38,6 +39,12 @@ ClickableLabel::~ClickableLabel()
}
void ClickableLabel::setOpacity( float opacity )
{
m_opacity = opacity;
}
void
ClickableLabel::mousePressEvent( QMouseEvent* event )
{
@ -85,6 +92,6 @@ void
ClickableLabel::paintEvent( QPaintEvent* event )
{
QPainter painter( this );
painter.setOpacity( 0.5 );
painter.setOpacity( m_opacity );
painter.drawText( contentsRect(), text() );
}

View File

@ -35,6 +35,8 @@ public:
ClickableLabel( QWidget* parent );
virtual ~ClickableLabel();
void setOpacity( float opacity );
signals:
void clicked();
void resized( const QPoint& delta );
@ -51,6 +53,7 @@ private:
bool m_pressed;
bool m_moved;
QTime m_time;
float m_opacity;
};
#endif // CLICKABLELABEL_H