Synchronize same font looking between QML and c++
Unsolved
QML and Qt Quick
-
Qt 5.15.8
QML and c++ code use the same font.
QML:
TextEdit { ... font: settings.font // font.preferShaping = false doesn't help ... renderType: Text.QtRendering // Text.NativeRendering also doesn't paint correctly }
letters (corners are rounded):
C++:
QSGNode* Text::updatePaintNode(QSGNode* oldNode, QQuickItem::UpdatePaintNodeData*) { ... QImage image(QSize(size, QImage::Format_ARGB32_Premultiplied); QPainter painter(&image); //painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); doesn't help also image.fill(QColor(0, 0, 0, 0)); painter.setFont(settings.font()); painter.drawText(rect, alignment, text)); ... }
letters (sharp corners):
How can I synchronize looking of the fonts between QML and c++ ?