[Interest] Text is not being anti-aliased.

william.crocker at analog.com william.crocker at analog.com
Fri Jan 30 16:56:39 CET 2015


Hello:

I have code to create a PNG file from a QGraphicsScene.
When I run this on Linux, text is anti-aliased. This is good.
When I run this on Windows, text is NOT anti-aliased. This is bad.
I would like the text to be anti-aliased.

Am I doing something wrong?
Is this a Windows bug?
Is there a workaround?

Thanks.

Bill

Qt 4.8.6
Visual Studio 2008

---------------------------------
void
MyScene::exportImagePNG( const QString &fn ) {
     QRectF scene_rect = sceneRect();
     QSize size(qRound(scene_rect.width()),qRound(scene_rect.height()));
     QImage im(size,QImage::Format_RGB32);
     QPainter painter(&im);
     painter.setRenderHint(QPainter::Antialiasing,true);
     painter.setRenderHint(QPainter::TextAntialiasing,true);
     painter.fillRect(im.rect(),Qt::white);
     render(&painter);
     im.save(fn,"PNG");
}



More information about the Interest mailing list