MCPcopy Create free account
hub / github.com/LMMS/lmms / paintEvent

Method paintEvent

src/gui/widgets/TextFloat.cpp:128–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126
127
128void TextFloat::paintEvent( QPaintEvent * _pe )
129{
130 QStyleOption opt;
131 opt.init( this );
132 QPainter p( this );
133 p.fillRect( 0, 0, width(), height(), QColor( 0, 0, 0, 0 ) );
134
135/* p.setPen( p.pen().brush().color() );
136 p.setBrush( p.background() );*/
137
138 p.setFont( pointSize<8>( p.font() ) );
139
140 style()->drawPrimitive( QStyle::PE_Widget, &opt, &p, this );
141
142/* p.drawRect( 0, 0, rect().right(), rect().bottom() );*/
143
144 if( m_title.isEmpty() )
145 {
146 p.drawText( opt.rect, Qt::AlignCenter, m_text );
147 }
148 else
149 {
150 int text_x = opt.rect.left() + 2;
151 int text_y = opt.rect.top() + 12;
152 if( m_pixmap.isNull() == false )
153 {
154 p.drawPixmap( opt.rect.topLeft() + QPoint( 5, 5 ), m_pixmap );
155 text_x += m_pixmap.width() + 8;
156 }
157 p.drawText( text_x, text_y + 16, m_text );
158 QFont f = p.font();
159 f.setBold( true );
160 p.setFont( f );
161 p.drawText( text_x, text_y, m_title );
162 }
163}
164
165
166

Callers

nothing calls this directly

Calls 5

drawPrimitiveMethod · 0.80
leftMethod · 0.80
isNullMethod · 0.80
initMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected