1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-18 06:48:23 +01:00

* Paint linear gradient as header background.

This commit is contained in:
Christian Muehlhaeuser 2012-12-07 05:54:11 +01:00
parent 82efe3bf49
commit 1d32eeffde
4 changed files with 43 additions and 10 deletions

View File

@ -96,10 +96,8 @@ InfoBar::InfoBar( QWidget* parent )
ui->horizontalLayout->addWidget( m_searchWidget );
QPalette pal = palette();
pal.setColor( QPalette::Window, QColor( "#454e59" ) );
setPalette( pal );
setAutoFillBackground( true );
setFixedHeight( 80 );
connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterAvailable( bool ) ) );
@ -286,10 +284,28 @@ InfoBar::onFilterEdited()
void
InfoBar::changeEvent( QEvent* e )
InfoBar::paintEvent( QPaintEvent* event )
{
QWidget::changeEvent( e );
switch ( e->type() )
QWidget::paintEvent( event );
QPainter painter( this );
painter.setRenderHint( QPainter::Antialiasing );
QLinearGradient gradient( QPoint( 0, 0 ), QPoint( 0, 1 ) );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
gradient.setColorAt( 0.0, QColor( "#615858" ) );
gradient.setColorAt( 1.0, QColor( "#231F1F" ) );
painter.setBrush( gradient );
painter.fillRect( event->rect(), gradient );
}
void
InfoBar::changeEvent( QEvent* event )
{
QWidget::changeEvent( event );
switch ( event->type() )
{
case QEvent::LanguageChange:
// ui->retranslateUi( this );

View File

@ -68,7 +68,8 @@ signals:
void filterTextChanged( const QString& filter );
protected:
void changeEvent( QEvent* e );
void changeEvent( QEvent* event );
void paintEvent( QPaintEvent* event );
private slots:
void onFilterEdited();

View File

@ -81,11 +81,7 @@ BasicHeader::BasicHeader( QWidget* parent )
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
setFixedHeight( 80 );
pal = palette();
pal.setColor( QPalette::Window, QColor( "#454e59" ) );
setPalette( pal );
setAutoFillBackground( true );
}
@ -113,3 +109,21 @@ BasicHeader::setPixmap( const QPixmap& p )
{
m_imageLabel->setPixmap( p.scaledToHeight( m_imageLabel->height(), Qt::SmoothTransformation ) );
}
void
BasicHeader::paintEvent( QPaintEvent* event )
{
QWidget::paintEvent( event );
QPainter painter( this );
painter.setRenderHint( QPainter::Antialiasing );
QLinearGradient gradient( QPoint( 0, 0 ), QPoint( 0, 1 ) );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
gradient.setColorAt( 0.0, QColor( "#615858" ) );
gradient.setColorAt( 1.0, QColor( "#231F1F" ) );
painter.setBrush( gradient );
painter.fillRect( event->rect(), gradient );
}

View File

@ -42,6 +42,8 @@ public slots:
virtual void setPixmap( const QPixmap& p );
protected:
virtual void paintEvent( QPaintEvent* event );
QLabel* m_imageLabel;
ElidedLabel* m_captionLabel;
ElidedLabel* m_descriptionLabel;