Merge pull request #917 from xiaoyifang/fix/statusbar

fix: statusbar crash  at some rare conditions
This commit is contained in:
xiaoyifang 2023-07-01 22:59:04 +08:00 committed by GitHub
commit 2621fd694d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 * )