[vlc-commits] Qt: don't try to show an uninitialized time tooltip

Ludovic Fauvet git at videolan.org
Thu Mar 15 23:50:55 CET 2012


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Mar 15 22:39:22 2012 +0100| [0891bbe75522d1c523ae75063ea7c1d0aedabc23] | committer: Jean-Baptiste Kempf

Qt: don't try to show an uninitialized time tooltip

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/util/timetooltip.cpp |   10 ++++++++--
 modules/gui/qt4/util/timetooltip.hpp |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/util/timetooltip.cpp b/modules/gui/qt4/util/timetooltip.cpp
index 06f98ff..bf6eb87 100644
--- a/modules/gui/qt4/util/timetooltip.cpp
+++ b/modules/gui/qt4/util/timetooltip.cpp
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright © 2011 VideoLAN
+ * Copyright © 2011-2012 VideoLAN
  * $Id$
  *
  * Authors: Ludovic Fauvet <etix at l0cal.com>
@@ -31,7 +31,7 @@
 #define TIP_HEIGHT 5
 
 TimeTooltip::TimeTooltip( QWidget *parent ) :
-    QWidget( parent )
+    QWidget( parent ), mInitialized( false )
 {
     setWindowFlags( Qt::Window                  |
                     Qt::WindowStaysOnTopHint    |
@@ -123,6 +123,7 @@ void TimeTooltip::buildPath()
 
 void TimeTooltip::setTip( const QPoint& target, const QString& time, const QString& text )
 {
+    mInitialized = true;
     mDisplayedText = time;
     if ( !text.isEmpty() )
         mDisplayedText.append( " - " ).append( text );
@@ -138,6 +139,11 @@ void TimeTooltip::setTip( const QPoint& target, const QString& time, const QStri
     update();
 }
 
+void TimeTooltip::show()
+{
+    QWidget::setVisible( mInitialized );
+}
+
 void TimeTooltip::paintEvent( QPaintEvent * )
 {
     QPainter p( this );
diff --git a/modules/gui/qt4/util/timetooltip.hpp b/modules/gui/qt4/util/timetooltip.hpp
index e8923bc..af10368 100644
--- a/modules/gui/qt4/util/timetooltip.hpp
+++ b/modules/gui/qt4/util/timetooltip.hpp
@@ -37,6 +37,7 @@ class TimeTooltip : public QWidget
 public:
     explicit TimeTooltip( QWidget *parent = 0 );
     void setTip( const QPoint& pos, const QString& time, const QString& text );
+    virtual void show();
 
 protected:
     virtual void paintEvent( QPaintEvent * );
@@ -53,6 +54,7 @@ private:
     QPainterPath mPainterPath;
     QBitmap mMask;
     int mTipX;
+    bool mInitialized;
 };
 
 #endif // TIMETOOLTIP_H



More information about the vlc-commits mailing list