Widgets: pass QWidget pointer to standardIcon/Pixmap() if available

Pass the pointer to the QWidget the icon is painted on to
QStyle::standardIcon/Pixmap().

Change-Id: If9dbc3acb621fb60152f2e12fc0080f354397a99
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-10-08 12:33:06 +02:00
parent 60cff8e9aa
commit 217c607782
3 changed files with 4 additions and 4 deletions

View File

@ -257,7 +257,7 @@ QErrorMessage::QErrorMessage(QWidget * parent)
grid->setRowStretch(0, 42);
#if QT_CONFIG(messagebox)
d->icon->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxInformation));
d->icon->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxInformation, nullptr, this));
d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
#endif
d->again->setChecked(true);

View File

@ -189,7 +189,7 @@ void QCommandLinkButtonPrivate::init()
q->setIconSize(QSize(20, 20));
QStyleOptionButton opt;
q->initStyleOption(&opt);
q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink, &opt));
q->setIcon(q->style()->standardIcon(QStyle::SP_CommandLink, &opt, q));
}
// Calculates the height of the description text based on widget width

View File

@ -27,9 +27,9 @@ void QToolBarExtension::setOrientation(Qt::Orientation o)
QStyleOption opt;
opt.initFrom(this);
if (o == Qt::Horizontal) {
setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, &opt));
setIcon(style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton, &opt, this));
} else {
setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton, &opt));
setIcon(style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton, &opt, this));
}
m_orientation = o;
}