From 6d83d6180ce46a7bea1e4fbd30b368db160037e7 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 31 Aug 2009 18:48:39 +0000 Subject: [PATCH] do not parse HTML tags for fader tag text --- src/audiomixerboard.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 184078e5..6f1abfac 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -60,6 +60,16 @@ CChannelFader::CChannelFader ( QWidget* pNW, pLabel->setAutoFillBackground ( true ); pLabel->setFrameShape ( QFrame::Box ); + // do not allow HTML tags, align center and use some margin + pLabel->setTextFormat ( Qt::PlainText ); + pLabel->setAlignment ( Qt::AlignHCenter ); + pLabel->setMargin ( 3 ); + + // set bold text + QFont curFont = pLabel->font(); + curFont.setBold ( true ); + pLabel->setFont ( curFont ); + // add user controls to grid pMainGrid->addWidget( pFader, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pcbMute, 0, Qt::AlignLeft ); @@ -179,28 +189,21 @@ void CChannelFader::SetText ( const QString sText ) { const int iBreakPos = 8; - // make sure we insert an HTML space (" ") at each beginning and end - // of line for nicer look - // break text at predefined position, if text is too short, break anyway to // make sure we have two lines for fader tag QString sModText = sText; if ( sModText.length() > iBreakPos ) { - sModText.insert ( iBreakPos, QString ( " 
 " ) ); + sModText.insert ( iBreakPos, QString ( "\n" ) ); } else { // insert line break at the beginning of the string -> make sure // if we only have one line that the text appears at the bottom line - sModText.insert ( 0, QString ( " 
 " ) ); + sModText.prepend ( QString ( "\n" ) ); } - // use bold centered text - sModText.prepend ( "
 " ); - sModText.append ( " 
" ); - pLabel->setText ( sModText ); }