From c8c503c42e57427cd4d3f2659284533552ca3fd3 Mon Sep 17 00:00:00 2001 From: Cy Rossignol Date: Tue, 20 Apr 2021 14:57:44 -0500 Subject: [PATCH] Avoid reloading redundant GUI stylesheets This skips the application of theme stylesheets when saving the GUI options if the user doesn't change the theme. Reloading stylesheets can be expensive for a wallet with many transactions. --- src/qt/bitcoingui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index cb4b2d54ce..bb46a4ea26 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -279,6 +279,12 @@ std::string FromQString(QString qs) void BitcoinGUI::setOptionsStyleSheet(QString qssFileName) { + // Applying a stylesheet can be rather expensive on a wallet with many + // transactions. Avoid reloading styles if the theme didn't change: + if (qssFileName == sSheet) { + return; + } + // setting the style sheets for the app QFile qss(":/stylesheets/"+qssFileName); if (qss.open(QIODevice::ReadOnly)){