-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2, 6.3.0
-
None
-
Tested on Windows 11
I've notice that there is an inconsistency between the behavior of the underline position in a text rendered using QPainter and text rendered in Qt Quick.
For example, in the picture below the left text is rendered using QPainter (in a QQuickPaintedItem) and the right text is rendered using Text from QtQuick

As you can see on the left hand side the underline is much closer to the baseline, while there is a noticeable gap on the right.
The code I've used for the LHS is:
painter->setRenderHint(QPainter::Antialiasing);
QFont font {"Arial", 50};
font.setUnderline(true);
QPointF pos (100, 60);
painter->setFont(font);
painter->drawText(pos, "hello");
While the RHS is rendered using:
Text{
text: "hello"
font.family: "Arial"
font.underline: true
font.pointSize: 50
renderType: Text.QtRendering
}
I would've expected the two rendering systems to behave similarly as I thought QtQuick was using QFontMetricsF internally.