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

Method paintEvent

plugins/audio_file_processor/audio_file_processor.cpp:683–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681
682
683void AudioFileProcessorView::paintEvent( QPaintEvent * )
684{
685 QPainter p( this );
686
687 p.drawPixmap( 0, 0, *s_artwork );
688
689 audioFileProcessor * a = castModel<audioFileProcessor>();
690
691 QString file_name = "";
692 int idx = a->m_sampleBuffer.audioFile().length();
693
694 p.setFont( pointSize<8>( font() ) );
695
696 QFontMetrics fm( p.font() );
697
698 // simple algorithm for creating a text from the filename that
699 // matches in the white rectangle
700 while( idx > 0 &&
701 fm.size( Qt::TextSingleLine, file_name + "..." ).width() < 210 )
702 {
703 file_name = a->m_sampleBuffer.audioFile()[--idx] + file_name;
704 }
705
706 if( idx > 0 )
707 {
708 file_name = "..." + file_name;
709 }
710
711 p.setPen( QColor( 255, 255, 255 ) );
712 p.drawText( 8, 99, file_name );
713}
714
715
716

Callers

nothing calls this directly

Calls 4

drawLineMethod · 0.80
sampleLengthMethod · 0.80
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected