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 Pick-to: 6.8 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>
This commit is contained in:
parent
87e53579ea
commit
4488dfcbf6
@ -1373,7 +1373,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:
|
||||
@ -1857,6 +1857,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…
x
Reference in New Issue
Block a user