[vlc-devel] [PATCH] Qt: don't try to show an uninitialized time tooltip
Ludovic Fauvet
etix at videolan.org
Thu Mar 15 22:39:22 CET 2012
---
modules/gui/qt4/util/timetooltip.cpp | 10 +++++++++-
modules/gui/qt4/util/timetooltip.hpp | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt4/util/timetooltip.cpp b/modules/gui/qt4/util/timetooltip.cpp
index 06f98ff..da5cdd9 100644
--- a/modules/gui/qt4/util/timetooltip.cpp
+++ b/modules/gui/qt4/util/timetooltip.cpp
@@ -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,13 @@ void TimeTooltip::setTip( const QPoint& target, const QString& time, const QStri
update();
}
+void TimeTooltip::show()
+{
+ if( !mInitialized )
+ return;
+ QWidget::show();
+}
+
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
--
1.7.9.4
More information about the vlc-devel
mailing list