From 785d2b9d0728bbbc0d2a92b7d4186a3114d54128 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 27 Feb 2019 12:08:42 +0000 Subject: Add QStyle::standardPixmap support to all entries in QDialogButtonBox QDialogButtonBox fetches icons from the qstyle for most of the buttons it creates, with the exception of 7. This patch adds support for the remaining buttons, so that all buttons can have icons added by the theme. Behavior is unchanged until a style implements these new enumerations. Change-Id: I2eba488a11e1b9979fff3b32dafbda11332a3d92 Reviewed-by: Kai Uwe Broulik Reviewed-by: Shawn Rutledge --- src/widgets/styles/qstyle.h | 7 +++++++ src/widgets/widgets/qdialogbuttonbox.cpp | 13 +++++++++++++ 2 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index 5ee37bd8e9..ee234457f5 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -832,6 +832,13 @@ public: SP_MediaVolume, SP_MediaVolumeMuted, SP_LineEditClearButton, + SP_DialogYesToAllButton, + SP_DialogNoToAllButton, + SP_DialogSaveAllButton, + SP_DialogAbortButton, + SP_DialogRetryButton, + SP_DialogIgnoreButton, + SP_RestoreDefaultsButton, // do not add any values below/greater than this SP_CustomBase = 0xf0000000 }; diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 26b86f80be..28f6cdc7bd 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -387,12 +387,25 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut icon = QStyle::SP_DialogNoButton; break; case QDialogButtonBox::YesToAll: + icon = QStyle::SP_DialogYesToAllButton; + break; case QDialogButtonBox::NoToAll: + icon = QStyle::SP_DialogNoToAllButton; + break; case QDialogButtonBox::SaveAll: + icon = QStyle::SP_DialogSaveAllButton; + break; case QDialogButtonBox::Abort: + icon = QStyle::SP_DialogAbortButton; + break; case QDialogButtonBox::Retry: + icon = QStyle::SP_DialogRetryButton; + break; case QDialogButtonBox::Ignore: + icon = QStyle::SP_DialogIgnoreButton; + break; case QDialogButtonBox::RestoreDefaults: + icon = QStyle::SP_RestoreDefaultsButton; break; case QDialogButtonBox::NoButton: return 0; -- cgit v1.2.3