1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-19 04:11:46 +02:00

Fix DropDownButton font size and boldness

This commit is contained in:
Dominik Schmidt
2016-01-17 03:33:05 +01:00
parent fc413ac103
commit 996d112ebb
2 changed files with 16 additions and 2 deletions

View File

@@ -46,6 +46,9 @@ DropDownButton::paintEvent( QPaintEvent* event )
{ {
// QComboBox::paintEvent( event ); // QComboBox::paintEvent( event );
QPainter p( this ); QPainter p( this );
setupPainter( &p );
drawPrimitive( &p, contentsRect(), currentText(), true, true ); drawPrimitive( &p, contentsRect(), currentText(), true, true );
} }
@@ -54,8 +57,8 @@ void
DropDownButton::drawPrimitive( QPainter* p, const QRect& rect, const QString& text, bool hovering, bool itemsAvailable ) DropDownButton::drawPrimitive( QPainter* p, const QRect& rect, const QString& text, bool hovering, bool itemsAvailable )
{ {
p->save(); p->save();
QFont f = p->font();
f.setPointSize( 8 ); setupPainter( p );
p->setRenderHint( QPainter::TextAntialiasing ); p->setRenderHint( QPainter::TextAntialiasing );
QRect r = rect.adjusted( 2, 2, -2, -2 ); QRect r = rect.adjusted( 2, 2, -2, -2 );
@@ -113,3 +116,13 @@ DropDownButton::mousePressEvent( QMouseEvent* event )
event->accept(); event->accept();
emit clicked(); emit clicked();
} }
void
DropDownButton::setupPainter( QPainter* p )
{
QFont f = p->font();
f.setPointSize( TomahawkUtils::defaultFontSize() - 1 );
f.setBold( true );
p->setFont( f );
}

View File

@@ -46,6 +46,7 @@ protected:
private slots: private slots:
private: private:
static void setupPainter( QPainter* p );
}; };
#endif // DROPDOWNBUTTON_H #endif // DROPDOWNBUTTON_H