diff options
author | David Edmundson <davidedmundson@kde.org> | 2019-02-27 12:08:42 +0000 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-03-02 06:27:05 +0000 |
commit | 785d2b9d0728bbbc0d2a92b7d4186a3114d54128 (patch) | |
tree | ac7f5e8c33539500ef54e7d5974ac36795bd7da1 /src | |
parent | 9eb50751b859cf46aa69ca5707346bd4a74a5f90 (diff) |
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 <kde@privat.broulik.de>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qstyle.h | 7 | ||||
-rw-r--r-- | src/widgets/widgets/qdialogbuttonbox.cpp | 13 |
2 files changed, 20 insertions, 0 deletions
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; |