From 59785478c3912551da9308942eccef8f0987dd1c Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 12 Jan 2021 18:10:35 +0100 Subject: macOS: Add more padding to width of non-editable comboboxes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The width of the combobox took the space for the checkmark and the contents into account, but didn't provide any padding on the right side, resulting in the text hitting the right side of the combobox popup. Add another 12 pixels padding to the sizeFromContents implementation, which results in a symmetrical padding on both sides of the text. Fixes: QTBUG-88715 Change-Id: I811da73d11ce935c1fb83efabbe799f9a882e1d7 Reviewed-by: Tor Arne Vestbø Reviewed-by: Timur Pocheptsov (cherry picked from commit ee409a536e7e1e4da28e235c4979a31cf40bb3c4) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/styles/mac/qmacstyle_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/styles/mac/qmacstyle_mac.mm') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 453a9e0830..1d924fd0d0 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -6473,9 +6473,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, if (const auto *cb = qstyleoption_cast(opt)) { const auto controlSize = d->effectiveAquaSizeConstrain(opt, widget); if (!cb->editable) { - // Same as CT_PushButton, because we have to fit the focus + // See CT_PushButton; we have to fit the focus // ring and a non-editable combo box is a NSPopUpButton. - sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12; + sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 24; // All values as measured from HIThemeGetButtonBackgroundBounds() if (controlSize != QStyleHelper::SizeMini) sz.rwidth() += 12; // We like 12 over here. -- cgit v1.2.3