I want to draw text using QPainter , and first I want to use QPainterPath (because in the end I want to rotate the text in different ways). However, I find that the text created by QPainterPath is much uglier than the text created by QPainter .
The following code:
void MyWidget::paintEvent(QPaintEvent* /*event*/) { QFont font; font.setStyleHint(QFont::Times, QFont::PreferAntialias); font.setPointSize(30); QPainter painter; painter.begin(this); painter.setRenderHint(QPainter::Antialiasing); painter.setBrush(Qt::black); painter.setFont(font); painter.drawText(10, 40, "Hello World"); QPainterPath textPath; textPath.addText(10, 100, font, "Hello world"); painter.drawPath(textPath); painter.end(); }
gives the following result:

The first is clearly much cleaner and nicer, especially in small fonts. What should I do to get the same result from QPainterPath ?
I am doing the above results on a computer running Windows 7 with Qt 5.0.
source share