Вы хотите создать подкласс QStyle, если хотите предоставить свои собственные значки, переопределить слот standardIconImplementation () в своем подклассе и вернуть оттуда новый значок.Ниже приведен пример:
class MyProxyStyle : public QProxyStyle
{
Q_OBJECT
public:
MyProxyStyle(QStyle *style = 0) : QProxyStyle(style) { }
public slots:
QIcon standardIconImplementation(StandardPixmap standardIcon,
const QStyleOption *option = 0,
const QWidget *widget = 0) const
{
// check the standardIcon parameter for the icon type
if (standardIcon==QStyle::SP_DesktopIcon)
{
// return your new icon here
standardIcon = QStyle::SP_DirIcon;
}
return QProxyStyle::standardIconImplementation(standardIcon, option, widget);
}
};
вот как вы можете его использовать:
// set new style for your widget
setStyle(new MyProxyStyle(style()));
// return different icon for QStyle::SP_DesktopIcon
action0->setIcon(style()->standardIcon(QStyle::SP_DesktopIcon));
надеюсь, это поможет, с уважением