From 9165815c89d34014e489fd6593f37e8c6ab8c397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20One=C8=9B?= Date: Mon, 22 Sep 2014 20:04:16 +0300 Subject: Fix the drawing of elided text in QHeaderView. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The text was not drawn properly because when eliding the text a fixed value '4' was substracted from the rect to compute the available width instead of the actual value of the header margin. Change-Id: I1e110f1a6490679730ddf5815d3ff7b679dc1a47 Task-number: QTBUG-24772 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qheaderview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index c074652cf3..95e845d196 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2671,8 +2671,9 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical opt.iconAlignment = Qt::AlignVCenter; opt.text = d->model->headerData(logicalIndex, d->orientation, Qt::DisplayRole).toString(); + const int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this); if (d->textElideMode != Qt::ElideNone) - opt.text = opt.fontMetrics.elidedText(opt.text, d->textElideMode , rect.width() - 4); + opt.text = opt.fontMetrics.elidedText(opt.text, d->textElideMode , rect.width() - margin); QVariant variant = d->model->headerData(logicalIndex, d->orientation, Qt::DecorationRole); -- cgit v1.2.3