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

Method paintEvent

src/gui/PluginBrowser.cpp:135–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133
134
135void PluginDescWidget::paintEvent( QPaintEvent * e )
136{
137
138 QPainter p( this );
139
140 // Paint everything according to the style sheet
141 QStyleOption o;
142 o.initFrom( this );
143 style()->drawPrimitive( QStyle::PE_Widget, &o, &p, this );
144
145 // Draw the rest
146 const int s = 16 + ( 32 * ( tLimit( height(), 24, 60 ) - 24 ) ) /
147 ( 60 - 24 );
148 const QSize logo_size( s, s );
149 QPixmap logo = m_logo.scaled( logo_size, Qt::KeepAspectRatio,
150 Qt::SmoothTransformation );
151 p.drawPixmap( 4, 4, logo );
152
153 QFont f = p.font();
154 if ( m_mouseOver )
155 {
156 f.setBold( true );
157 }
158
159 p.setFont( f );
160 p.drawText( 10 + logo_size.width(), 15,
161 m_pluginDescriptor.displayName );
162
163 if( height() > 24 || m_mouseOver )
164 {
165 f.setBold( false );
166 p.setFont( f );
167 QRect br;
168 p.drawText( 10 + logo_size.width(), 20, width() - 58 - 5, 999,
169 Qt::TextWordWrap,
170 qApp->translate( "pluginBrowser", m_pluginDescriptor.description ),
171 &br );
172 if( m_mouseOver )
173 {
174 m_targetHeight = qMax( 60, 25 + br.height() );
175 }
176 }
177}
178
179
180

Callers

nothing calls this directly

Calls 2

tLimitFunction · 0.85
drawPrimitiveMethod · 0.80

Tested by

no test coverage detected