QWindows11Style: Fix sorting arrows in headers

Fixes: QTBUG-126345
Change-Id: Ifb0bb46329a909fd113318f61ca37ba01f4d873d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 81642477d979e00f9507df37184e75d9ed98ee2f)
This commit is contained in:
Wladimir Leuschner 2024-06-25 14:43:11 +02:00
parent cd48b781d1
commit 61c67cf499

View File

@ -823,6 +823,18 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
}
}
break;
case PE_IndicatorHeaderArrow:
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
painter->setPen(header->palette.text().color());
painter->setFont(assetFont);
QRectF rect = option->rect;
if (header->sortIndicator & QStyleOptionHeader::SortUp) {
painter->drawText(rect,Qt::AlignCenter,"\uE96D");
} else if (header->sortIndicator & QStyleOptionHeader::SortDown) {
painter->drawText(rect,Qt::AlignCenter,"\uE96E");
}
}
break;
case PE_IndicatorCheckBox:
{
QNumberStyleAnimation* animation = qobject_cast<QNumberStyleAnimation*>(d->animation(option->styleObject));
@ -1812,6 +1824,10 @@ QRect QWindows11Style::subElementRect(QStyle::SubElement element, const QStyleOp
ret = QWindowsVistaStyle::subElementRect(element, option, widget);
}
break;
case QStyle::SE_HeaderLabel:
case QStyle::SE_HeaderArrow:
ret = QCommonStyle::subElementRect(element, option, widget);
break;
default:
ret = QWindowsVistaStyle::subElementRect(element, option, widget);
}