Commit 9653db32 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Qt: fix a visibility issue within the time tooltip

The first show() was never satisfied because the widget was not
initialized at this point.
parent ce58fbba
...@@ -53,10 +53,19 @@ TimeTooltip::TimeTooltip( QWidget *parent ) : ...@@ -53,10 +53,19 @@ TimeTooltip::TimeTooltip( QWidget *parent ) :
// Inherit from the system default font size -5 // Inherit from the system default font size -5
mFont = QFont( "Verdana", qMax( qApp->font().pointSize() - 5, 7 ) ); mFont = QFont( "Verdana", qMax( qApp->font().pointSize() - 5, 7 ) );
mTipX = -1; mTipX = -1;
// By default the widget is unintialized and should not be displayed
resize( 0, 0 );
} }
void TimeTooltip::adjustPosition() void TimeTooltip::adjustPosition()
{ {
if( mDisplayedText.isEmpty() )
{
resize( 0, 0 );
return;
}
// Get the bounding box required to print the text and add some padding // Get the bounding box required to print the text and add some padding
QFontMetrics metrics( mFont ); QFontMetrics metrics( mFont );
QRect textbox = metrics.boundingRect( mDisplayedText ); QRect textbox = metrics.boundingRect( mDisplayedText );
...@@ -141,7 +150,7 @@ void TimeTooltip::setTip( const QPoint& target, const QString& time, const QStri ...@@ -141,7 +150,7 @@ void TimeTooltip::setTip( const QPoint& target, const QString& time, const QStri
void TimeTooltip::show() void TimeTooltip::show()
{ {
QWidget::setVisible( mInitialized ); setVisible( true );
#ifdef Q_OS_OS2 #ifdef Q_OS_OS2
// Bring a tooltip on the top // Bring a tooltip on the top
// Without this, tooltip does not appear on fullscreen // Without this, tooltip does not appear on fullscreen
......
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