From 976ad7e3e72025bf81add89b75a0968dd5d587fe Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 May 2019 15:35:56 +0200 Subject: [PATCH] [libcalamaresui] Look up icons via theme - Don't cache icons, because they could be changed via the active desktop theme. --- src/libcalamaresui/Branding.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 680e9b926..4dc07ff19 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -297,15 +297,21 @@ Branding::imagePath( Branding::ImageEntry imageEntry ) const QPixmap Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const { - QPixmap pixmap = - ImageRegistry::instance()->pixmap( imagePath( imageEntry ), size ); - - if ( pixmap.isNull() ) + const auto path = imagePath( imageEntry ); + if ( path.contains( '/' ) ) { - Q_ASSERT( false ); - return QPixmap(); + QPixmap pixmap = ImageRegistry::instance()->pixmap( path, size ); + + Q_ASSERT( !pixmap.isNull() ); + return pixmap; + } + else + { + auto icon = QIcon::fromTheme(path); + + Q_ASSERT( !icon.isNull() ); + return icon.pixmap( size ); } - return pixmap; } QString