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

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

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4a9aaa84
/*****************************************************************************
* 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 );
......
......@@ -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
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