QCommonStyle::drawControl: use PM_HeaderMargin instead magic number

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 <tmartsum@gmail.com>
bb10
Christian Ehrlicher 2018-02-02 07:57:57 +01:00
parent 2950de715e
commit 8db29d92df
1 changed files with 3 additions and 2 deletions

View File

@ -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();