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

[reg] Antialising can't be disabled when high dpi scaling is enabled

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.14.0
    • None
    • Windows

    Description

      When setting the attribute Qt::AA_EnableHighDpiScaling you can no longer disable Antialising the fonts via the QFont::NoAntialias style strategy.

      This worked in 5.13.2

      Minimal Example

      #include <QApplication>
      #include <QBoxLayout>
      #include <QPlainTextEdit>
      #include <QPushButton>
      
      int main(int argc, char *argv[])
      {
          // comment out this line to be able to switch antialising
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QApplication a(argc, argv);
      
          auto layout = new QVBoxLayout;
          auto edit = new QPlainTextEdit;
          edit->setPlainText("this is a test\nfor turning on antialiasing\nof fonts\n");
          auto button = new QPushButton("switch AA");
          layout->addWidget(edit);
          layout->addWidget(button);
          QObject::connect(button, &QPushButton::pressed, [edit]() {
              QFont f = edit->font();
              f.setStyleStrategy(f.styleStrategy() & QFont::NoAntialias ? QFont::PreferAntialias
                                                                        : QFont::NoAntialias);
              edit->setFont(f);
          });
      
          QWidget w;
          w.setLayout(layout);
          w.show();
          return a.exec();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              sorvig Morten Sørvig
              davschul David Schulz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes