rbutil: Rework Logo display.

Replace QLabel with QSvgWidget so the widget draws the svg directly
instead of first creating a pixmap from it.

This also avoids an issue when building with mxe which causes the image
to not show due to a missing svg plugin (which doesn't happen for svg
icons.)

Change-Id: Ic4e265f0567984d1ffe7a3e1cc641df27755e90b
This commit is contained in:
Dominik Riebeling 2022-02-21 19:16:49 +01:00
parent 83e4078d9c
commit 8d462a1edd
3 changed files with 24 additions and 20 deletions

View file

@ -123,7 +123,8 @@ if(APPLE)
endif() endif()
target_link_libraries(RockboxUtility rbbase cutelogger gitversion target_link_libraries(RockboxUtility rbbase cutelogger gitversion
Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia) Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia
Qt${QT_VERSION_MAJOR}::Svg)
target_include_directories(RockboxUtility PRIVATE target_include_directories(RockboxUtility PRIVATE
${CMAKE_CURRENT_LIST_DIR}/gui ${CMAKE_CURRENT_LIST_DIR}/gui

View file

@ -88,6 +88,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
ui.setupUi(this); ui.setupUi(this);
QIcon windowIcon(":/icons/rockbox-clef.svg"); QIcon windowIcon(":/icons/rockbox-clef.svg");
this->setWindowIcon(windowIcon); this->setWindowIcon(windowIcon);
ui.logoLabel->load(QLatin1String(":/icons/rockbox-logo.svg"));
#if defined(Q_OS_MACX) #if defined(Q_OS_MACX)
// don't translate menu entries that are handled specially on OS X // don't translate menu entries that are handled specially on OS X
// (Configure, Quit). Qt handles them for us if they use english string. // (Configure, Quit). Qt handles them for us if they use english string.

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>650</width> <width>631</width>
<height>399</height> <height>441</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -19,8 +19,8 @@
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0"> <item row="0" column="1">
<widget class="QLabel" name="logoLabel"> <widget class="QSvgWidget" name="logoLabel" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -39,21 +39,15 @@
<height>62</height> <height>62</height>
</size> </size>
</property> </property>
<property name="text"> <property name="toolTip">
<string comment="Welcome to Rockbox Utility, the installation and housekeeping tool for Rockbox."/> <string>Welcome to Rockbox Utility, the installation and housekeeping tool for Rockbox.</string>
</property> </property>
<property name="pixmap"> <property name="accessibleName">
<pixmap resource="rbutilqt.qrc">:/icons/rockbox-logo.svg</pixmap> <string>Rockbox Logo</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="2">
<widget class="QGroupBox" name="groupBoxDevice"> <widget class="QGroupBox" name="groupBoxDevice">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -74,7 +68,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="rbutilqt.qrc">:/icons/rockbox-32.png</pixmap> <pixmap>:/icons/rockbox-32.png</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>false</bool> <bool>false</bool>
@ -159,7 +153,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2"> <item row="1" column="0" colspan="3">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
@ -384,8 +378,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>650</width> <width>631</width>
<height>22</height> <height>30</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@ -632,6 +626,14 @@
</property> </property>
</action> </action>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QSvgWidget</class>
<extends>QWidget</extends>
<header location="global">QSvgWidget</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>buttonChangeDevice</tabstop> <tabstop>buttonChangeDevice</tabstop>