Style: pass widget to styleHint() where appropriate

QStyle::styleHint() take the QWidget as optional third parameter. Add
this to calls to styleHint() where appropriate.

Task-number: QTBUG-2501
Pick-to: 6.9 6.8
Change-Id: I62aa251f7dd9d78178ea8aefc1e2882d3ac040be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Christian Ehrlicher 2024-11-21 19:05:45 +01:00
parent df97b6b2de
commit 5b320c146b
4 changed files with 4 additions and 4 deletions

View File

@ -259,7 +259,7 @@ QAccessible::State QAccessibleMenuItem::state() const
s.focused = true;
#endif
}
if (own && own->style()->styleHint(QStyle::SH_Menu_MouseTracking))
if (own && own->style()->styleHint(QStyle::SH_Menu_MouseTracking, nullptr, own))
s.hotTracked = true;
if (m_action->isSeparator() || !m_action->isEnabled())
s.disabled = true;

View File

@ -1793,7 +1793,7 @@ void QListViewPrivate::prepareItemsLayout()
layoutBounds = QRect(QPoint(), q->maximumViewportSize());
int frameAroundContents = 0;
if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)) {
if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, nullptr, q)) {
QStyleOption option;
option.initFrom(q);
frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &option, q) * 2;

View File

@ -565,7 +565,7 @@ public:
Q_Q(QWidget);
if (qApp->autoSipEnabled()) {
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel, nullptr, q));
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
QGuiApplication::inputMethod()->show();
}

View File

@ -775,7 +775,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
case PE_FrameFocusRect:
if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
//### check for d->alt_down
if (!(fropt->state & State_KeyboardFocusChange) && !proxy()->styleHint(SH_UnderlineShortcut, opt))
if (!(fropt->state & State_KeyboardFocusChange) && !proxy()->styleHint(SH_UnderlineShortcut, opt, w))
return;
QRect r = opt->rect;
p->save();