Qt: Try to speed up SplashOverlay

Limit the amount of event processing SplashOverlay does. Let QWidget
take care of painting.

Change-Id: I9176baeba2cc9203e50c02029d85689f8908daba
Reviewed-on: https://code.wireshark.org/review/14771
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2016-03-31 13:25:44 -07:00
parent 3db7b1ed04
commit e6a65afd3e
3 changed files with 9 additions and 16 deletions

View File

@ -188,7 +188,7 @@ MainWelcome::MainWelcome(QWidget *parent) :
#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
// This crashes with Qt 4.8.3 on OS X.
QGraphicsBlurEffect *blur = new QGraphicsBlurEffect(welcome_ui_->childContainer);
blur->setBlurRadius(1.3);
blur->setBlurRadius(2);
welcome_ui_->childContainer->setGraphicsEffect(blur);
#endif

View File

@ -62,7 +62,13 @@ SplashOverlay::SplashOverlay(QWidget *parent) :
so_ui_->progressBar->setMaximum((int)register_count() + register_add);
elapsed_timer_.start();
setPalette(Qt::transparent);
QColor bg = QColor(tango_aluminium_6);
bg.setAlphaF(0.4);
QPalette pal;
pal.setColor(QPalette::Background, bg);
setPalette(pal);
setAutoFillBackground(true);
setStyleSheet(QString(
"QLabel {"
" color: white;"
@ -172,20 +178,10 @@ void SplashOverlay::splashUpdate(register_action_e action, const char *message)
so_ui_->progressBar->setValue(register_cur_);
wsApp->processEvents();
wsApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 1);
elapsed_timer_.restart();
}
void SplashOverlay::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setBrush(QColor(tango_aluminium_6));
painter.setOpacity(0.4);
painter.drawRect(rect());
}
/*
* Editor modelines
*

View File

@ -45,9 +45,6 @@ public:
explicit SplashOverlay(QWidget *parent = 0);
~SplashOverlay();
protected:
void paintEvent(QPaintEvent *event);
private:
Ui::SplashOverlay *so_ui_;
bool blurred_;