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:
parent
198b44c03f
commit
523357a0a6
@ -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() );
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user