diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-11-07 13:27:58 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-11-16 09:16:41 +0000 |
commit | 2b908b6324a78842b7dbd6b50da03baecd70b3fa (patch) | |
tree | 5d0bdf9f963e5b4a88e74549a4163e128de18ddf | |
parent | e05f25fcbc8dfd7bfd71caf2499895851af4e484 (diff) |
Fix printing of labels for line series charts
The labels ended up getting way to big on the printer, because
they didn't respect the transform set by the PDF engine when
setting the font size.
Fix the same problem in AreaChartItem::paint().
Change-Id: I18fd6ebb4c4031c7b2df423cf842b39ff9891135
Fixes: QTBUG-67981
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/charts/areachart/areachartitem.cpp | 4 | ||||
-rw-r--r-- | src/charts/xychart/qxyseries.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/charts/areachart/areachartitem.cpp b/src/charts/areachart/areachartitem.cpp index df3cc8af..d53500fe 100644 --- a/src/charts/areachart/areachartitem.cpp +++ b/src/charts/areachart/areachartitem.cpp @@ -261,7 +261,9 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt else painter->setClipping(false); - painter->setFont(m_pointLabelsFont); + QFont f(m_pointLabelsFont); + f.setPixelSize(QFontInfo(m_pointLabelsFont).pixelSize()); + painter->setFont(f); painter->setPen(QPen(m_pointLabelsColor)); QFontMetrics fm(painter->font()); diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp index 81bdcd16..547bdf63 100644 --- a/src/charts/xychart/qxyseries.cpp +++ b/src/charts/xychart/qxyseries.cpp @@ -1008,7 +1008,9 @@ void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QP static const QString yPointTag(QLatin1String("@yPoint")); const int labelOffset = offset + 2; - painter->setFont(m_pointLabelsFont); + QFont f(m_pointLabelsFont); + f.setPixelSize(QFontInfo(m_pointLabelsFont).pixelSize()); + painter->setFont(f); painter->setPen(QPen(m_pointLabelsColor)); QFontMetrics fm(painter->font()); // m_points is used for the label here as it has the series point information |