[vlc-commits] Qt: fix a visibility issue within the time tooltip
Ludovic Fauvet
git at videolan.org
Fri Jul 19 12:57:20 CEST 2013
vlc/vlc-2.1 | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Jul 17 13:43:04 2013 +0200| [23663568c6b502847353e77934a9af0b2f437240] | committer: Jean-Baptiste Kempf
Qt: fix a visibility issue within the time tooltip
The first show() was never satisfied because the widget was not
initialized at this point.
(cherry picked from commit 9653db32b9670e25c587cb0308b7aef97aa08f7f)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=23663568c6b502847353e77934a9af0b2f437240
---
modules/gui/qt4/util/timetooltip.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt4/util/timetooltip.cpp b/modules/gui/qt4/util/timetooltip.cpp
index 185622a..d085719 100644
--- a/modules/gui/qt4/util/timetooltip.cpp
+++ b/modules/gui/qt4/util/timetooltip.cpp
@@ -53,10 +53,19 @@ TimeTooltip::TimeTooltip( QWidget *parent ) :
// Inherit from the system default font size -5
mFont = QFont( "Verdana", qMax( qApp->font().pointSize() - 5, 7 ) );
mTipX = -1;
+
+ // By default the widget is unintialized and should not be displayed
+ resize( 0, 0 );
}
void TimeTooltip::adjustPosition()
{
+ if( mDisplayedText.isEmpty() )
+ {
+ resize( 0, 0 );
+ return;
+ }
+
// Get the bounding box required to print the text and add some padding
QFontMetrics metrics( mFont );
QRect textbox = metrics.boundingRect( mDisplayedText );
@@ -141,7 +150,7 @@ void TimeTooltip::setTip( const QPoint& target, const QString& time, const QStri
void TimeTooltip::show()
{
- QWidget::setVisible( mInitialized );
+ setVisible( true );
#ifdef Q_OS_OS2
// Bring a tooltip on the top
// Without this, tooltip does not appear on fullscreen
More information about the vlc-commits
mailing list