Skip to content

Commit

Permalink
Qt: don't try to show an uninitialized time tooltip
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Baptiste Kempf <[email protected]>
  • Loading branch information
etix authored and jbkempf committed Mar 15, 2012
1 parent 4a9aaa8 commit 0891bbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/gui/qt4/util/timetooltip.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright © 2011 VideoLAN
* Copyright © 2011-2012 VideoLAN
* $Id$
*
* Authors: Ludovic Fauvet <[email protected]>
Expand Down Expand Up @@ -31,7 +31,7 @@
#define TIP_HEIGHT 5

TimeTooltip::TimeTooltip( QWidget *parent ) :
QWidget( parent )
QWidget( parent ), mInitialized( false )
{
setWindowFlags( Qt::Window |
Qt::WindowStaysOnTopHint |
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
2 changes: 2 additions & 0 deletions modules/gui/qt4/util/timetooltip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 * );
Expand All @@ -53,6 +54,7 @@ class TimeTooltip : public QWidget
QPainterPath mPainterPath;
QBitmap mMask;
int mTipX;
bool mInitialized;
};

#endif // TIMETOOLTIP_H

0 comments on commit 0891bbe

Please sign in to comment.