Commit ab05bbd1 authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by Jean-Baptiste Kempf

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

(cherry picked from commit 0891bbe75522d1c523ae75063ea7c1d0aedabc23)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 041b92e4
/*****************************************************************************
* Copyright © 2011 VideoLAN
* Copyright © 2011-2012 VideoLAN
* $Id$
*
* Authors: Ludovic Fauvet <etix@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 );
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment