mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Merge pull request #917 from xiaoyifang/fix/statusbar
fix: statusbar crash at some rare conditions
This commit is contained in:
commit
2621fd694d
|
@ -40,6 +40,9 @@ MainStatusBar::MainStatusBar( QWidget *parent ) : QWidget( parent )
|
|||
connect( timer, &QTimer::timeout, this, &MainStatusBar::clearMessage );
|
||||
|
||||
setAutoFillBackground( true );
|
||||
|
||||
if ( parent )
|
||||
move( 0, parent->height() - height() );
|
||||
}
|
||||
|
||||
void MainStatusBar::clearMessage()
|
||||
|
@ -67,29 +70,23 @@ void MainStatusBar::setBackgroundMessage(const QString & bkg_message )
|
|||
}
|
||||
}
|
||||
|
||||
void MainStatusBar::showMessage(const QString & str, int timeout, const QPixmap & pixmap)
|
||||
void MainStatusBar::showMessage( const QString & str, int timeout, const QPixmap & pixmap )
|
||||
{
|
||||
textWidget->setText( message = str );
|
||||
picWidget->setPixmap( pixmap );
|
||||
|
||||
if ( !picWidget->pixmap().isNull() )
|
||||
{
|
||||
if ( !picWidget->pixmap().isNull() ) {
|
||||
picWidget->setFixedSize( textWidget->height(), textWidget->height() );
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
picWidget->setFixedSize( 0, 0 );
|
||||
}
|
||||
|
||||
if ( timeout > 0 )
|
||||
{
|
||||
if ( timeout > 0 ) {
|
||||
timer->start( timeout );
|
||||
}
|
||||
if ( parentWidget() && parentWidget()->isVisible() ) {
|
||||
raise();
|
||||
show();
|
||||
move( QPoint( 0, parentWidget()->height() - height() ) );
|
||||
}
|
||||
raise();
|
||||
show();
|
||||
}
|
||||
|
||||
void MainStatusBar::mousePressEvent ( QMouseEvent * )
|
||||
|
|
Loading…
Reference in a new issue