From 360e705d9cbb1c1120fc10c64099d82ceaf7fa0d Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Mon, 22 Jan 2024 07:32:25 +0000 Subject: [PATCH] sync: from linuxdeepin/qt5integration Synchronize source files from linuxdeepin/qt5integration. Source-pull-request: https://github.com/linuxdeepin/qt5integration/pull/211 --- styleplugins/chameleon/chameleonstyle.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/styleplugins/chameleon/chameleonstyle.cpp b/styleplugins/chameleon/chameleonstyle.cpp index 6814613..20e624f 100644 --- a/styleplugins/chameleon/chameleonstyle.cpp +++ b/styleplugins/chameleon/chameleonstyle.cpp @@ -2412,7 +2412,11 @@ bool ChameleonStyle::drawComboBox(QPainter *painter, const QStyleOptionComboBox arrowOpt.rect.setSize(QSize(qRound(arrowOpt.rect.height() / 2.4), qRound(arrowOpt.rect.height() / 2.4))); arrowOpt.rect.moveCenter(center); int radius = DStyle::pixelMetric(PM_FrameRadius); - arrowOpt.rect = arrowOpt.rect.adjusted(-radius, 0, -radius, 0); + if (comboBox->direction == Qt::RightToLeft) { + arrowOpt.rect = arrowOpt.rect.adjusted(radius, 0, radius, 0); + } else { + arrowOpt.rect = arrowOpt.rect.adjusted(-radius , 0, -radius, 0); + } } painter->setPen(getColor(comboBox, DPalette::ButtonText)); @@ -2439,7 +2443,7 @@ bool ChameleonStyle::drawComboBoxLabel(QPainter *painter, const QStyleOptionComb QRect contentsRect(cb->rect); if (sunken && !flat) contentsRect.translate(1, 1); - contentsRect.adjust(Metrics::Layout_ChildMarginWidth, 0, -Metrics::Layout_ChildMarginWidth - DStyle::pixelMetric(PM_FrameRadius), 0); + contentsRect.adjust(Metrics::Layout_ChildMarginWidth, 0, -Metrics::Layout_ChildMarginWidth - DStyle::pixelMetric(PM_FrameRadius) * 2, 0); QSize iconSize; if (hasIcon) { iconSize = cb->iconSize; @@ -2478,8 +2482,8 @@ bool ChameleonStyle::drawComboBoxLabel(QPainter *painter, const QStyleOptionComb } // handle right to left - if (iconRect.isValid()) iconRect = visualRect(cb->direction, cb->rect, iconRect); - if (textRect.isValid()) textRect = visualRect(cb->direction, cb->rect, textRect); + if (iconRect.isValid()) iconRect = visualRect(cb->direction, contentsRect, iconRect); + if (textRect.isValid()) textRect = visualRect(cb->direction, contentsRect, textRect); // render icon if (hasIcon && iconRect.isValid()) {