1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-19 23:41:51 +02:00

* Set opacity on ClickableLabel.

This commit is contained in:
Christian Muehlhaeuser 2014-08-13 06:05:17 +02:00
parent 198b44c03f
commit 523357a0a6
2 changed files with 15 additions and 4 deletions

View File

@ -21,14 +21,18 @@
#include <QApplication>
#include <QMouseEvent>
#include <QPainter>
ClickableLabel::ClickableLabel( QWidget* parent )
: QLabel( parent )
, m_pressed( false )
, m_moved( false )
{
setCursor( Qt::PointingHandCursor );
}
ClickableLabel::~ClickableLabel()
{
}
@ -76,3 +80,11 @@ ClickableLabel::mouseMoveEvent( QMouseEvent* event )
}
}
void
ClickableLabel::paintEvent( QPaintEvent* event )
{
QPainter painter( this );
painter.setOpacity( 0.5 );
painter.drawText( contentsRect(), text() );
}

View File

@ -36,18 +36,17 @@ public:
virtual ~ClickableLabel();
signals:
void clicked();
void resized( const QPoint& delta );
public slots:
protected:
void mousePressEvent( QMouseEvent* event );
void mouseReleaseEvent( QMouseEvent* event );
void mouseMoveEvent( QMouseEvent* event );
private:
void paintEvent( QPaintEvent* event );
private:
QPoint m_dragPoint;
bool m_pressed;
bool m_moved;