diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2017-12-09 22:41:41 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2017-12-12 19:07:10 +0000 |
commit | 06e903cf684a829716736702b95b66846c713fd5 (patch) | |
tree | bbf9332d88f8b17563e06e304df89c43cd11be20 /src/widgets/itemviews/qheaderview.cpp | |
parent | 26aa20407d2e3feb97d80dabc1d922d4ef21a433 (diff) |
QHeaderView: Use correct font for drag'n'drop indicator pixmap
QHeaderViewPrivate::setupSectionIndicator() did not honor the font
set for the QHeaderView which results in a wrong font in the indicator
pixmap. Fix it by using the correct font for the dragged section as
it is done in paintEvent()
Task-number: QTBUG-65017
Change-Id: I5393c6861073de22f30ffa13e12c5e2cf8aa7776
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 9eb6c3465f..0905a20812 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3159,6 +3159,15 @@ void QHeaderViewPrivate::setupSectionIndicator(int section, int position) QRect rect(0, 0, w, h); QPainter painter(&pm); + const QVariant variant = model->headerData(section, orientation, + Qt::FontRole); + if (variant.isValid() && variant.canConvert<QFont>()) { + const QFont sectionFont = qvariant_cast<QFont>(variant); + painter.setFont(sectionFont); + } else { + painter.setFont(q->font()); + } + painter.setOpacity(0.75); q->paintSection(&painter, rect, section); painter.end(); |