From 8db29d92df0ef9fbc39d88945d16a16f43edf20e Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 2 Feb 2018 07:57:57 +0100 Subject: [PATCH] QCommonStyle::drawControl: use PM_HeaderMargin instead magic number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace '2' with the correct margin retrieved from PM_HeaderMargin during paniting of CE_HeaderLabel within QCommonStyle::drawControl(). Change-Id: I5a50e02f107a00f382a38e14c4d3fa8dcb97ad12 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/styles/qcommonstyle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 6fb55f0b5f..1276eef1d1 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1583,10 +1583,11 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, aligned.width() * pixmap.devicePixelRatio(), pixmap.height() * pixmap.devicePixelRatio()); + const int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); if (header->direction == Qt::LeftToRight) - rect.setLeft(rect.left() + pixw + 2); + rect.setLeft(rect.left() + pixw + margin); else - rect.setRight(rect.right() - pixw - 2); + rect.setRight(rect.right() - pixw - margin); } if (header->state & QStyle::State_On) { QFont fnt = p->font();