[vlc-commits] Qt: don't try to show an uninitialized time tooltip
Ludovic Fauvet
git at videolan.org
Fri Mar 16 01:27:11 CET 2012
vlc/vlc-2.0 | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Mar 15 22:39:22 2012 +0100| [ab05bbd17efddc95596cd3cb2dfc281f942082d1] | committer: Jean-Baptiste Kempf
Qt: don't try to show an uninitialized time tooltip
(cherry picked from commit 0891bbe75522d1c523ae75063ea7c1d0aedabc23)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=ab05bbd17efddc95596cd3cb2dfc281f942082d1
---
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 9b8ab14..e0fa26f 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>
@@ -30,7 +30,7 @@
#define TIP_HEIGHT 5
TimeTooltip::TimeTooltip( QWidget *parent ) :
- QWidget( parent )
+ QWidget( parent ), mInitialized( false )
{
setWindowFlags( Qt::Window |
Qt::WindowStaysOnTopHint |
@@ -108,6 +108,7 @@ void TimeTooltip::buildPath()
void TimeTooltip::setText( const QString& time, const QString& text )
{
+ mInitialized = true;
mDisplayedText = time;
if ( !text.isEmpty() )
mDisplayedText.append( " - " ).append( text );
@@ -120,6 +121,11 @@ void TimeTooltip::setText( const QString& time, const QString& text )
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 6e74f64..4e74286 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 setText( const QString& time, const QString& text );
+ virtual void show();
protected:
virtual void paintEvent( QPaintEvent * );
@@ -51,6 +52,7 @@ private:
QPainterPath mPainterPath;
QBitmap mMask;
int mPreviousMetricsWidth;
+ bool mInitialized;
};
#endif // TIMETOOLTIP_H
More information about the vlc-commits
mailing list