QWindows11Style: Add horizontal offset for Qt::AlignVCenter Labels
The progressbar label overlaps with the progressbar grove, when vertically centered aligned. This patch adds a y offset to the label, in case it is vertically centered to avoid the overlap. Fixes: QTBUG-128458 Change-Id: Iac977f83f09c2e4d12d1e0ed5f0eab3120c07b96 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit 564633f9d4e4cc8fa361de8165a9dfb203b7248e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 4488dfcbf68163f4aee7575254c6c880c7e69ab1)bb10
parent
835c54bc19
commit
fd3918bcaa
|
|
@ -1343,7 +1343,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
|
|||
if (const QStyleOptionProgressBar* progbaropt = qstyleoption_cast<const QStyleOptionProgressBar*>(option)) {
|
||||
QRect rect = subElementRect(SE_ProgressBarLabel, progbaropt, widget);
|
||||
painter->setPen(progbaropt->palette.text().color());
|
||||
painter->drawText(rect, progbaropt->text,Qt::AlignVCenter|Qt::AlignLeft);
|
||||
painter->drawText(rect, progbaropt->text,progbaropt->textAlignment);
|
||||
}
|
||||
break;
|
||||
case CE_PushButtonLabel:
|
||||
|
|
@ -1815,6 +1815,15 @@ QRect QWindows11Style::subElementRect(QStyle::SubElement element, const QStyleOp
|
|||
ret = QWindowsVistaStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
break;
|
||||
case QStyle::SE_ProgressBarLabel:
|
||||
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
|
||||
if (pb->textAlignment.testFlags(Qt::AlignVCenter)) {
|
||||
ret = option->rect.adjusted(0, 6, 0, 0);
|
||||
} else {
|
||||
ret = QWindowsVistaStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QStyle::SE_HeaderLabel:
|
||||
case QStyle::SE_HeaderArrow:
|
||||
ret = QCommonStyle::subElementRect(element, option, widget);
|
||||
|
|
|
|||
Loading…
Reference in New Issue