Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38514

Linux: QFont::setStyleStrategy( QFont::NoAntialias ) does not disable antialiasing with non-gui app

    XMLWordPrintable

Details

    Description

      Using QApplication with GUIenabled 'false' the antialiasing cannot be disabled with QFont::setStyleStrategy(QFont::NoAntialias). This works correctly when GUIenabled is set to 'true'. Error is reproducible in Linux, but apparently not in Windows.

      #include <QApplication>
      #include <QtGui>
      
      int main( int argc, char** argv )
      {
          QApplication app( argc, argv, false );
      
          QImage image( 400, 300, QImage::Format_RGB32 );
          QFont font( "Helvetica", 24 );
          font.setStyleStrategy(QFont::NoAntialias);
          QPainter painter( &image );
      
          painter.setFont( font );
          painter.setPen( Qt::white );
          painter.fillRect( image.rect(), Qt::darkBlue );
          painter.drawText( image.rect(), Qt::AlignCenter, "Hello, world!" );
          image.save( "test.png", "PNG" );
      
          return 0;
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            qtcomsupport Qt Support
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes