diff --git a/src/gui/widgets/text_float.cpp b/src/gui/widgets/text_float.cpp index eede3884f..24d75043c 100644 --- a/src/gui/widgets/text_float.cpp +++ b/src/gui/widgets/text_float.cpp @@ -1,8 +1,8 @@ /* * text_float.cpp - class textFloat, a floating text-label * - * Copyright (c) 2005-2008 Tobias Doerffel - * + * Copyright (c) 2005-2010 Tobias Doerffel + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -22,7 +22,6 @@ * */ - #include #include @@ -35,8 +34,8 @@ textFloat::textFloat() : QWidget( engine::mainWindow(), Qt::ToolTip ), - m_title( "" ), - m_text( "" ), + m_title(), + m_text(), m_pixmap() { resize( 20, 20 ); @@ -138,9 +137,9 @@ void textFloat::paintEvent( QPaintEvent * _pe ) // p.setPen( Qt::black ); // small message? - if( m_title == "" ) + if( m_title.isEmpty() ) { - p.drawText( 2, 10, m_text ); + p.drawText( 2, p.fontMetrics().height()-2, m_text ); } else { @@ -173,7 +172,7 @@ void textFloat::updateSize() { QFontMetrics metrics( pointSize<8>( font() ) ); QRect textBound = metrics.boundingRect( m_text ); - if( m_title != "" ) + if( !m_title.isEmpty() ) { QFont f = pointSize<8>( font() ); f.setBold( true ); @@ -182,13 +181,13 @@ void textFloat::updateSize() { textBound.setWidth( title_w ); } - textBound.setHeight( textBound.height() * 2 + 14 ); + textBound.setHeight( textBound.height() * 2 + 8 ); } if( m_pixmap.isNull() == false ) { textBound.setWidth( textBound.width() + m_pixmap.width() + 10 ); } - resize( textBound.width() + 5, textBound.height()*3/4+2 ); + resize( textBound.width() + 5, textBound.height()+2 ); //move( QPoint( parentWidget()->width() + 5, 5 ) ); update(); }