Use icon themes in QPrintPreviewDialog [if they exist]

I've renamed a few of the qrc icons to the names most common icon themes use
for similar actions (the action themselves are not part of the icon naming spec
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
since it's not been updated in a while).

Task-number: QTBUG-85879
Change-Id: I23bb300dbf4e953517516c97b8af118859aeb6fa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Albert Astals Cid 2021-05-28 17:28:03 +02:00
parent ded82d1b07
commit 67a00f7706
15 changed files with 31 additions and 31 deletions

View File

@ -103,10 +103,10 @@ qt_internal_extend_target(PrintSupport CONDITION QT_FEATURE_printdialog
if(QT_FEATURE_printdialog)
# Resources:
set(qprintdialog_resource_files
"dialogs/images/fit-page-24.png"
"dialogs/images/fit-page-32.png"
"dialogs/images/fit-width-24.png"
"dialogs/images/fit-width-32.png"
"dialogs/images/zoom-fit-page-24.png"
"dialogs/images/zoom-fit-page-32.png"
"dialogs/images/zoom-fit-width-24.png"
"dialogs/images/zoom-fit-width-32.png"
"dialogs/images/go-first-24.png"
"dialogs/images/go-first-32.png"
"dialogs/images/go-last-24.png"
@ -121,14 +121,14 @@ if(QT_FEATURE_printdialog)
"dialogs/images/layout-portrait-32.png"
"dialogs/images/page-setup-24.png"
"dialogs/images/page-setup-32.png"
"dialogs/images/print-24.png"
"dialogs/images/print-32.png"
"dialogs/images/view-page-multi-24.png"
"dialogs/images/view-page-multi-32.png"
"dialogs/images/view-page-one-24.png"
"dialogs/images/view-page-one-32.png"
"dialogs/images/view-page-sided-24.png"
"dialogs/images/view-page-sided-32.png"
"dialogs/images/printer-24.png"
"dialogs/images/printer-32.png"
"dialogs/images/view-pages-overview-24.png"
"dialogs/images/view-pages-overview-32.png"
"dialogs/images/view-pages-single-24.png"
"dialogs/images/view-pages-single-32.png"
"dialogs/images/view-pages-facing-24.png"
"dialogs/images/view-pages-facing-32.png"
"dialogs/images/zoom-in-24.png"
"dialogs/images/zoom-in-32.png"
"dialogs/images/zoom-out-24.png"

View File

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 914 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 700 B

After

Width:  |  Height:  |  Size: 700 B

View File

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 908 B

View File

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 390 B

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

View File

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 662 B

View File

Before

Width:  |  Height:  |  Size: 810 B

After

Width:  |  Height:  |  Size: 810 B

View File

Before

Width:  |  Height:  |  Size: 985 B

After

Width:  |  Height:  |  Size: 985 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 706 B

After

Width:  |  Height:  |  Size: 706 B

View File

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 1004 B

View File

@ -1,9 +1,9 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/qt-project.org/dialogs/qprintpreviewdialog">
<file>images/fit-page-24.png</file>
<file>images/fit-page-32.png</file>
<file>images/fit-width-24.png</file>
<file>images/fit-width-32.png</file>
<file>images/zoom-fit-page-24.png</file>
<file>images/zoom-fit-page-32.png</file>
<file>images/zoom-fit-width-24.png</file>
<file>images/zoom-fit-width-32.png</file>
<file>images/go-first-24.png</file>
<file>images/go-first-32.png</file>
<file>images/go-last-24.png</file>
@ -18,14 +18,14 @@
<file>images/layout-portrait-32.png</file>
<file>images/page-setup-24.png</file>
<file>images/page-setup-32.png</file>
<file>images/print-24.png</file>
<file>images/print-32.png</file>
<file>images/view-page-multi-24.png</file>
<file>images/view-page-multi-32.png</file>
<file>images/view-page-one-24.png</file>
<file>images/view-page-one-32.png</file>
<file>images/view-page-sided-24.png</file>
<file>images/view-page-sided-32.png</file>
<file>images/printer-24.png</file>
<file>images/printer-32.png</file>
<file>images/view-pages-overview-24.png</file>
<file>images/view-pages-overview-32.png</file>
<file>images/view-pages-single-24.png</file>
<file>images/view-pages-single-32.png</file>
<file>images/view-pages-facing-24.png</file>
<file>images/view-pages-facing-32.png</file>
<file>images/zoom-in-24.png</file>
<file>images/zoom-in-32.png</file>
<file>images/zoom-out-24.png</file>

View File

@ -353,7 +353,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
static inline void qt_setupActionIcon(QAction *action, QLatin1String name)
{
QLatin1String imagePrefix(":/qt-project.org/dialogs/qprintpreviewdialog/images/");
QIcon icon;
QIcon icon = QIcon::fromTheme(name);
icon.addFile(imagePrefix + name + QLatin1String("-24.png"), QSize(24, 24));
icon.addFile(imagePrefix + name + QLatin1String("-32.png"), QSize(32, 32));
action->setIcon(icon);
@ -384,8 +384,8 @@ void QPrintPreviewDialogPrivate::setupActions()
fitPageAction->setObjectName(QLatin1String("fitPageAction"));
fitWidthAction->setCheckable(true);
fitPageAction->setCheckable(true);
qt_setupActionIcon(fitWidthAction, QLatin1String("fit-width"));
qt_setupActionIcon(fitPageAction, QLatin1String("fit-page"));
qt_setupActionIcon(fitWidthAction, QLatin1String("zoom-fit-width"));
qt_setupActionIcon(fitPageAction, QLatin1String("zoom-fit-page"));
QObject::connect(fitGroup, SIGNAL(triggered(QAction*)), q, SLOT(_q_fit(QAction*)));
// Zoom
@ -411,9 +411,9 @@ void QPrintPreviewDialogPrivate::setupActions()
singleModeAction = modeGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Show single page"));
facingModeAction = modeGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Show facing pages"));
overviewModeAction = modeGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Show overview of all pages"));
qt_setupActionIcon(singleModeAction, QLatin1String("view-page-one"));
qt_setupActionIcon(facingModeAction, QLatin1String("view-page-sided"));
qt_setupActionIcon(overviewModeAction, QLatin1String("view-page-multi"));
qt_setupActionIcon(singleModeAction, QLatin1String("view-pages-single"));
qt_setupActionIcon(facingModeAction, QLatin1String("view-pages-facing"));
qt_setupActionIcon(overviewModeAction, QLatin1String("view-pages-overview"));
singleModeAction->setObjectName(QLatin1String("singleModeAction"));
facingModeAction->setObjectName(QLatin1String("facingModeAction"));
overviewModeAction->setObjectName(QLatin1String("overviewModeAction"));
@ -427,7 +427,7 @@ void QPrintPreviewDialogPrivate::setupActions()
printerGroup = new QActionGroup(q);
printAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Print"));
pageSetupAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Page setup"));
qt_setupActionIcon(printAction, QLatin1String("print"));
qt_setupActionIcon(printAction, QLatin1String("printer"));
qt_setupActionIcon(pageSetupAction, QLatin1String("page-setup"));
QObject::connect(printAction, SIGNAL(triggered(bool)), q, SLOT(_q_print()));
QObject::connect(pageSetupAction, SIGNAL(triggered(bool)), q, SLOT(_q_pageSetup()));