Use font properties from CSS to draw the pattern labels

Use the font properties that are defined in the CSS to draw the pattern
labels. This provides flexibility with regards to the font properties
that are used (size, font family, etc.).

Adjust the CSS for the default theme and the classic theme.
This commit is contained in:
Michael Gregorius
2017-07-10 18:40:02 +02:00
parent c0a4f67544
commit a70d255418
3 changed files with 7 additions and 6 deletions

View File

@@ -596,6 +596,7 @@ TrackContentObjectView {
PatternView {
background-color: rgb( 119, 199, 216 );
color: rgb( 187, 227, 236 );
font-size: 11px;
}
/* sample track pattern */

View File

@@ -615,6 +615,7 @@ TrackContentObjectView {
PatternView {
background-color: #21A14F;
color: rgba(255,255,255,220);
font-size: 11px;
}
/* sample track pattern */

View File

@@ -1076,15 +1076,14 @@ void PatternView::paintEvent( QPaintEvent * )
{
p.setRenderHint( QPainter::TextAntialiasing );
QFont font;
font.setHintingPreference( QFont::PreferFullHinting );
font.setPointSize( 8 );
p.setFont( font );
QFont labelFont = this->font();
labelFont.setHintingPreference( QFont::PreferFullHinting );
p.setFont( labelFont );
const int textTop = TCO_BORDER_WIDTH + 1;
const int textLeft = TCO_BORDER_WIDTH + 3;
QFontMetrics fontMetrics(font);
QFontMetrics fontMetrics(labelFont);
QString elidedPatternName = fontMetrics.elidedText(m_pat->name(), Qt::ElideMiddle, width() - 2 * textLeft);
QColor transparentBlack(0, 0, 0, 75);
@@ -1110,7 +1109,7 @@ void PatternView::paintEvent( QPaintEvent * )
p.setPen( ( current && !beatPattern ) ? c.lighter( 130 ) : c.darker( 300 ) );
p.drawRect( 0, 0, rect().right(), rect().bottom() );
}
// draw the 'muted' pixmap only if the pattern was manualy muted
// draw the 'muted' pixmap only if the pattern was manually muted
if( m_pat->isMuted() )
{
const int spacing = TCO_BORDER_WIDTH;