QCommonStyle: adjust painting CE_ComboBoxLabel text

Sync the rect used for painting a CE_ComboBoxLabel text with QLineEdit
which is used for an editable QComboBox.

Task-number: QTBUG-130824
Change-Id: I9f3a31d68c6abed7e9cba4235847df3fa0d51ad1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit dc1ae86bad0b4eaa83909f663777c09fb2f2376b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2024-11-03 13:43:23 +01:00 committed by Qt Cherry-pick Bot
parent b3aa4b32b0
commit 7c34903e4b

View File

@ -2248,7 +2248,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
editRect.translate(cb->iconSize.width() + 4, 0);
}
if (!cb->currentText.isEmpty() && !cb->editable) {
proxy()->drawItemText(p, editRect.adjusted(1, 0, -1, 0),
// keep in sync with QLineEditPrivate::horizontalMargin = 2
proxy()->drawItemText(p, editRect.adjusted(2, 0, -2, 0),
visualAlignment(cb->direction, cb->textAlignment),
cb->palette, cb->state & State_Enabled, cb->currentText);
}