Style: pass widget to styleHint() where appropriate
QStyle::styleHint() take the QWidget as optional third parameter. Add this to calls to styleHint() where appropriate. Fixes: QTBUG-2501 Pick-to: 6.9 6.8 Change-Id: Id4e4158cc889236064f2f618495608736607d457 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
176baa955a
commit
aa341ecca8
@ -326,7 +326,7 @@ void QAbstractButtonPrivate::init()
|
||||
{
|
||||
Q_Q(QAbstractButton);
|
||||
|
||||
q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy)));
|
||||
q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy, nullptr, q)));
|
||||
q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, controlType));
|
||||
q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
|
||||
q->setForegroundRole(QPalette::ButtonText);
|
||||
|
@ -1462,7 +1462,8 @@ void QCalendarView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
|
||||
QDate date = handleMouseEvent(event);
|
||||
validDateClicked = false;
|
||||
if (date == calendarModel->m_date && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
|
||||
if (date == calendarModel->m_date &&
|
||||
!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this)) {
|
||||
emit editingFinished();
|
||||
}
|
||||
}
|
||||
@ -1539,7 +1540,7 @@ void QCalendarView::mouseReleaseEvent(QMouseEvent *event)
|
||||
if (date.isValid()) {
|
||||
emit changeDate(date, true);
|
||||
emit clicked(date);
|
||||
if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick))
|
||||
if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, this))
|
||||
emit editingFinished();
|
||||
}
|
||||
validDateClicked = false;
|
||||
|
@ -2897,7 +2897,7 @@ void QComboBox::hidePopup()
|
||||
QItemSelectionModel *selectionModel = d->container->itemView()
|
||||
? d->container->itemView()->selectionModel() : nullptr;
|
||||
// Flash selected/triggered item (if any) before hiding the popup.
|
||||
if (style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem) &&
|
||||
if (style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem, nullptr, this) &&
|
||||
selectionModel && selectionModel->hasSelection()) {
|
||||
const QItemSelection selection = selectionModel->selection();
|
||||
|
||||
|
@ -367,7 +367,7 @@ QSize QPushButton::sizeHint() const
|
||||
// calculate contents size...
|
||||
#if !defined(QT_NO_ICON) && QT_CONFIG(dialogbuttonbox)
|
||||
bool showButtonBoxIcons = qobject_cast<QDialogButtonBox*>(parentWidget())
|
||||
&& style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons);
|
||||
&& style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, nullptr, this);
|
||||
|
||||
if (!icon().isNull() || showButtonBoxIcons) {
|
||||
int ih = opt.iconSize.height();
|
||||
|
@ -43,7 +43,7 @@ void QSliderPrivate::init()
|
||||
tickInterval = 0;
|
||||
tickPosition = QSlider::NoTicks;
|
||||
hoverControl = QStyle::SC_None;
|
||||
q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy)));
|
||||
q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy, nullptr, q)));
|
||||
QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::Slider);
|
||||
if (orientation == Qt::Vertical)
|
||||
sp.transpose();
|
||||
@ -333,7 +333,7 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
|
||||
setEditFocus(true);
|
||||
#endif
|
||||
ev->accept();
|
||||
if ((ev->button() & style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons)) == ev->button()) {
|
||||
if ((ev->button() & style()->styleHint(QStyle::SH_Slider_AbsoluteSetButtons, nullptr, this)) == ev->button()) {
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
const QRect sliderRect = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
|
||||
@ -345,7 +345,7 @@ void QSlider::mousePressEvent(QMouseEvent *ev)
|
||||
setRepeatAction(SliderNoAction);
|
||||
d->pressedControl = QStyle::SC_SliderHandle;
|
||||
update();
|
||||
} else if ((ev->button() & style()->styleHint(QStyle::SH_Slider_PageSetButtons)) == ev->button()) {
|
||||
} else if ((ev->button() & style()->styleHint(QStyle::SH_Slider_PageSetButtons, nullptr, this)) == ev->button()) {
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
d->pressedControl = style()->hitTestComplexControl(QStyle::CC_Slider,
|
||||
|
@ -1758,7 +1758,7 @@ bool QTabBar::event(QEvent *event)
|
||||
if (isTabEnabled(tabIndex) && d->switchTabCurrentIndex != tabIndex) {
|
||||
d->switchTabCurrentIndex = tabIndex;
|
||||
d->switchTabTimer.start(
|
||||
style()->styleHint(QStyle::SH_TabBar_ChangeCurrentDelay) * 1ms, this);
|
||||
style()->styleHint(QStyle::SH_TabBar_ChangeCurrentDelay, nullptr, this) * 1ms, this);
|
||||
}
|
||||
event->ignore();
|
||||
}
|
||||
@ -2378,7 +2378,7 @@ void QTabBar::keyPressEvent(QKeyEvent *event)
|
||||
void QTabBar::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
Q_D(QTabBar);
|
||||
if (style()->styleHint(QStyle::SH_TabBar_AllowWheelScrolling)) {
|
||||
if (style()->styleHint(QStyle::SH_TabBar_AllowWheelScrolling, nullptr, this)) {
|
||||
const bool wheelVertical = qAbs(event->angleDelta().y()) > qAbs(event->angleDelta().x());
|
||||
const bool tabsVertical = verticalTabs(d->shape);
|
||||
if (event->device()->capabilities().testFlag(QInputDevice::Capability::PixelScroll)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user