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

QFont::setPointSizeF() doesn't scale smoothly

    XMLWordPrintable

Details

    Description

      When changing the point size of a font using the floating point API, the font does not scale with the same precision as other primitive shapes such as lines.

      Test case:

      #include <QtGui>
      
      class MyWidget : public QWidget
      {
      public:
          MyWidget() : QWidget(0)
          {
          }
      
      protected:
          virtual void paintEvent(QPaintEvent *e)
          {
              QPainter p(this);
              p.scale(10, 10);
              for (int i = 0; i < 10; ++i) {
                  QFont font("Times");
                  font.setPointSizeF(0.2 * (i + 1));
                  p.setFont(font);
                  p.drawText(1, 2 + 3 * i, QString("This should be point size %1!").arg(font.pointSizeF()));
              }
          }
      };
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
          MyWidget widget;
          widget.resize(400, 300);
          widget.show();
          return app.exec();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              jabarron Jason Barron
              Votes:
              31 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes