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>
This commit is contained in:
David Edmundson 2019-02-27 12:08:42 +00:00 committed by Shawn Rutledge
parent 9eb50751b8
commit 785d2b9d07
2 changed files with 20 additions and 0 deletions

View File

@ -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
};

View File

@ -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;