diff options
author | Cristian Oneț <onet.cristian@gmail.com> | 2014-09-22 20:04:16 +0300 |
---|---|---|
committer | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2014-09-23 16:34:39 +0200 |
commit | 9165815c89d34014e489fd6593f37e8c6ab8c397 (patch) | |
tree | f33951d6e341fcb20986c19fc5defdec199aeebd /src/widgets/itemviews | |
parent | 00b1360d9de7097eda54df4836ee2b6c3b706bf7 (diff) |
Fix the drawing of elided text in QHeaderView.
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 <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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); |