mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Manually lower opacity for disabled ImageButtons.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -77,6 +77,7 @@ ImageButton::clear()
|
|||||||
setIcon( QIcon() );
|
setIcon( QIcon() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageButton::paintEvent( QPaintEvent* event )
|
ImageButton::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
@@ -85,14 +86,15 @@ ImageButton::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
QIcon::Mode mode = isDown()
|
QIcon::Mode mode = isDown()
|
||||||
? QIcon::Active
|
? QIcon::Active
|
||||||
: isEnabled()
|
: QIcon::Normal;
|
||||||
? QIcon::Normal
|
|
||||||
: QIcon::Disabled;
|
|
||||||
|
|
||||||
QIcon::State state = isChecked()
|
QIcon::State state = isChecked()
|
||||||
? QIcon::On
|
? QIcon::On
|
||||||
: QIcon::Off;
|
: QIcon::Off;
|
||||||
|
|
||||||
|
if ( !isEnabled() )
|
||||||
|
p.setOpacity( 0.4 );
|
||||||
|
|
||||||
icon().paint( &p, rect(), Qt::AlignCenter, mode, state );
|
icon().paint( &p, rect(), Qt::AlignCenter, mode, state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user