mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-30 01:00:13 +02:00
* Paint linear gradient as header background.
This commit is contained in:
@@ -96,10 +96,8 @@ InfoBar::InfoBar( QWidget* parent )
|
|||||||
ui->horizontalLayout->addWidget( m_searchWidget );
|
ui->horizontalLayout->addWidget( m_searchWidget );
|
||||||
|
|
||||||
QPalette pal = palette();
|
QPalette pal = palette();
|
||||||
pal.setColor( QPalette::Window, QColor( "#454e59" ) );
|
|
||||||
|
|
||||||
setPalette( pal );
|
setPalette( pal );
|
||||||
setAutoFillBackground( true );
|
|
||||||
setFixedHeight( 80 );
|
setFixedHeight( 80 );
|
||||||
|
|
||||||
connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterAvailable( bool ) ) );
|
connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterAvailable( bool ) ) );
|
||||||
@@ -286,10 +284,28 @@ InfoBar::onFilterEdited()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoBar::changeEvent( QEvent* e )
|
InfoBar::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
QWidget::changeEvent( e );
|
QWidget::paintEvent( event );
|
||||||
switch ( e->type() )
|
|
||||||
|
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:
|
case QEvent::LanguageChange:
|
||||||
// ui->retranslateUi( this );
|
// ui->retranslateUi( this );
|
||||||
|
@@ -68,7 +68,8 @@ signals:
|
|||||||
void filterTextChanged( const QString& filter );
|
void filterTextChanged( const QString& filter );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* event );
|
||||||
|
void paintEvent( QPaintEvent* event );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onFilterEdited();
|
void onFilterEdited();
|
||||||
|
@@ -81,11 +81,7 @@ BasicHeader::BasicHeader( QWidget* parent )
|
|||||||
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||||
setFixedHeight( 80 );
|
setFixedHeight( 80 );
|
||||||
|
|
||||||
pal = palette();
|
|
||||||
pal.setColor( QPalette::Window, QColor( "#454e59" ) );
|
|
||||||
|
|
||||||
setPalette( pal );
|
setPalette( pal );
|
||||||
setAutoFillBackground( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -113,3 +109,21 @@ BasicHeader::setPixmap( const QPixmap& p )
|
|||||||
{
|
{
|
||||||
m_imageLabel->setPixmap( p.scaledToHeight( m_imageLabel->height(), Qt::SmoothTransformation ) );
|
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 );
|
||||||
|
}
|
||||||
|
@@ -42,6 +42,8 @@ public slots:
|
|||||||
virtual void setPixmap( const QPixmap& p );
|
virtual void setPixmap( const QPixmap& p );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void paintEvent( QPaintEvent* event );
|
||||||
|
|
||||||
QLabel* m_imageLabel;
|
QLabel* m_imageLabel;
|
||||||
ElidedLabel* m_captionLabel;
|
ElidedLabel* m_captionLabel;
|
||||||
ElidedLabel* m_descriptionLabel;
|
ElidedLabel* m_descriptionLabel;
|
||||||
|
Reference in New Issue
Block a user