Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.2.1
-
None
-
OSX 10.9.2, Macbook Pro with retina screen
Description
Using QPainter to draw text on a QImage in 5.2.x produces results which are much less legible than in earlier versions. I'm using a Macbook Pro with retina screen (but I'm not using the retina display - the lid is shut and I have a 1080p monitor plugged in via HDMI). The following code illustrates the problem :
RenderTextToQImage.cpp
#include <QtCore/qglobal.h> #include <QtGui/QImage> #include <QtGui/QColor> #include <QtGui/QPainter> #if QT_VERSION >= QT_VERSION_CHECK( 5,0,0 ) #include <QtWidgets/QApplication> #else #include <QtGui/QApplication> #endif int main( int argc, char** argv ) { static const char* kSampleText = "ABCDEFGHI abcdefghi 0123456789"; QApplication app( argc, argv ); QImage image( 250, 30, QImage::Format_ARGB32 ); image.fill( QColor( 220,220,220,255 ) ); QFont font( QString( "tahoma" ), 12, QFont::Normal ); QPainter painter( &image ); painter.setFont( font ); painter.setPen( QColor( 100,100,100,255 ) ); painter.drawText( 20, 20, QString( kSampleText ) ); char tmp[ 256 ]; snprintf( tmp, 256, "%s/Documents/OutputFromQt-%x.png", getenv( "HOME" ), QT_VERSION ); image.save( QString( tmp ) ); return 0; }
Here's an image which shows the output from 4.8.4 next to the output from 5.2.1 :
https://www.dropbox.com/s/kbo6c2q5mn7wjb2/QtTextComparison.png
I mentioned the issue here where it was corroborated by another user.