From e6a65afd3ee567f743e6b2f4f8596f27445ed390 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 31 Mar 2016 13:25:44 -0700 Subject: 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 Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- ui/qt/main_welcome.cpp | 2 +- ui/qt/splash_overlay.cpp | 20 ++++++++------------ ui/qt/splash_overlay.h | 3 --- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp index 696f681204..691a457b6b 100644 --- a/ui/qt/main_welcome.cpp +++ b/ui/qt/main_welcome.cpp @@ -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 diff --git a/ui/qt/splash_overlay.cpp b/ui/qt/splash_overlay.cpp index a38fc1296f..fec318607a 100644 --- a/ui/qt/splash_overlay.cpp +++ b/ui/qt/splash_overlay.cpp @@ -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 * diff --git a/ui/qt/splash_overlay.h b/ui/qt/splash_overlay.h index 2cae0c1694..3aae85ff5a 100644 --- a/ui/qt/splash_overlay.h +++ b/ui/qt/splash_overlay.h @@ -45,9 +45,6 @@ public: explicit SplashOverlay(QWidget *parent = 0); ~SplashOverlay(); -protected: - void paintEvent(QPaintEvent *event); - private: Ui::SplashOverlay *so_ui_; bool blurred_; -- cgit v1.2.3