/*****************************************************************************
- * Copyright © 2011 VideoLAN
+ * Copyright © 2011-2012 VideoLAN
* $Id$
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
#define TIP_HEIGHT 5
TimeTooltip::TimeTooltip( QWidget *parent ) :
- QWidget( parent )
+ QWidget( parent ), mInitialized( false )
{
setWindowFlags( Qt::Window |
Qt::WindowStaysOnTopHint |
void TimeTooltip::setTip( const QPoint& target, const QString& time, const QString& text )
{
+ mInitialized = true;
mDisplayedText = time;
if ( !text.isEmpty() )
mDisplayedText.append( " - " ).append( text );
update();
}
+void TimeTooltip::show()
+{
+ QWidget::setVisible( mInitialized );
+}
+
void TimeTooltip::paintEvent( QPaintEvent * )
{
QPainter p( this );
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 * );
QPainterPath mPainterPath;
QBitmap mMask;
int mTipX;
+ bool mInitialized;
};
#endif // TIMETOOLTIP_H