1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

* Fixed ToggleButton not staying 'down' as it should.

This commit is contained in:
Christian Muehlhaeuser 2011-09-09 10:42:00 +02:00
parent 92240b6e0c
commit a667fbd8b4
3 changed files with 3 additions and 30 deletions

View File

@ -25,14 +25,14 @@
ToggleButton::ToggleButton( QWidget* parent )
: QPushButton( parent )
, m_toggled( false )
{
setStyleSheet( QString( "QPushButton { color: white; background-color: %1; border-style: outset; border-width: 1px; border-radius: 4px; border-color: white; font: bold; } "
"QPushButton:checked { background-color: %2; border-style: inset; }"
"QPushButton:pressed { background-color: %2; border-style: inset; }" )
.arg( StyleHelper::headerUpperColor().name() )
.arg( StyleHelper::headerLowerColor().darker().name() ) );
connect( this, SIGNAL( released() ), SLOT( onToggled() ) );
setCheckable( true );
}
@ -41,24 +41,6 @@ ToggleButton::~ToggleButton()
}
void
ToggleButton::setDown( bool b )
{
m_toggled = b;
QPushButton::setDown( b );
}
void
ToggleButton::onToggled()
{
m_toggled ^= true;
setDown( m_toggled );
emit toggled( m_toggled );
}
void
ToggleButton::paintEvent( QPaintEvent* event )
{

View File

@ -36,17 +36,8 @@ public:
ToggleButton( QWidget* parent = 0 );
virtual ~ToggleButton();
public slots:
void setDown( bool b );
protected:
virtual void paintEvent( QPaintEvent* );
private slots:
void onToggled();
private:
bool m_toggled;
};
#endif

View File

@ -70,7 +70,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->albumHeader->setContentsMargins( 0, 0, 4, 0 );
ui->button->setFixedWidth( 200 );
ui->button->setDown( true );
ui->button->setChecked( true );
m_pixmap = QPixmap( RESPATH "images/no-album-art-placeholder.png" ).scaledToWidth( 48, Qt::SmoothTransformation );