From 11189af016c1deeefed476c5cc3a408f6ee79a2d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 4 Feb 2014 09:07:43 +0100 Subject: [PATCH] Remove some left-over +1 in font height calculation In change cb8445f0323b0eefbb04f1d8adad81a00b53abd8, I tried to remove all the historical +1s when calculating the font height from the ascent and descent, but I missed a couple. These are used when drawing the background for the text, the height of which would no longer match the height returned from QFontMetrics. [ChangeLog][Text] Fixed off-by-one in the height of text background. Task-number: QTBUG-36444 Change-Id: If6d87f903e246f9faed2298bb1693b2556906eed Reviewed-by: Simon Hausmann --- src/gui/painting/qemulationpaintengine.cpp | 2 +- src/gui/painting/qpainter.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp index bb87b4fd6e..0fb907b6c5 100644 --- a/src/gui/painting/qemulationpaintengine.cpp +++ b/src/gui/painting/qemulationpaintengine.cpp @@ -169,7 +169,7 @@ void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &text { if (state()->bgMode == Qt::OpaqueMode) { const QTextItemInt &ti = static_cast(textItem); - QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); + QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent).toReal()); fillBGRect(rect); } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fbb4c2eb56..2944130eaa 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6353,7 +6353,7 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText QTextItemInt &ti = const_cast(static_cast(_ti)); if (!extended && state->bgMode == Qt::OpaqueMode) { - QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); + QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent).toReal()); q->fillRect(rect, state->bgBrush); }