[vlc-commits] Qt: fix a visibility issue within the time tooltip

Ludovic Fauvet git at videolan.org
Wed Jul 17 14:52:10 CEST 2013


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Jul 17 13:43:04 2013 +0200| [9653db32b9670e25c587cb0308b7aef97aa08f7f] | committer: Ludovic Fauvet

Qt: fix a visibility issue within the time tooltip

The first show() was never satisfied because the widget was not
initialized at this point.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9653db32b9670e25c587cb0308b7aef97aa08f7f
---

 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