]> git.sesse.net Git - vlc/commitdiff
Qt: don't try to show an uninitialized time tooltip
authorLudovic Fauvet <etix@videolan.org>
Thu, 15 Mar 2012 21:39:22 +0000 (22:39 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 15 Mar 2012 22:38:42 +0000 (23:38 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/util/timetooltip.cpp
modules/gui/qt4/util/timetooltip.hpp

index 06f98ff3005edce6003ead92b543f8541ca2985f..bf6eb875359c71da0d788c77947745646d3752fd 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright © 2011 VideoLAN
+ * Copyright © 2011-2012 VideoLAN
  * $Id$
  *
  * Authors: Ludovic Fauvet <etix@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 );
index e8923bc022e2fe15c8b61f249f96d82f7a191c56..af1036849d6fb7023915ae4e29b2ee9824fe2d88 100644 (file)
@@ -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