From 7c34903e4ba66a8968afccb3abdcc60f50cc3f77 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 3 Nov 2024 13:43:23 +0100 Subject: [PATCH] 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 (cherry picked from commit dc1ae86bad0b4eaa83909f663777c09fb2f2376b) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qcommonstyle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index de913350468..dc812fc15c8 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -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); }