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

Windows / Qt4.8: Text is scaled even worldmatrix and viewtransform are disabled

XMLWordPrintable

      Text is scaled to tiny with example below (scale 0.02) in Qt 4.8 Even worldmatrix and viewtransform are disabled. Correct behavior is that should not scale. Case occurs when Font pixels size is over 63. Works fine in Qt 4.7 and Qt5.

      #include <QApplication>
      #include <QGraphicsView>
      
      class View : public QGraphicsView
      {
      public:
      View() : QGraphicsView() {
      QGraphicsScene *scene = new QGraphicsScene(this);
      setScene(scene);
      scale(0.02,0.02);
      scene->setSceneRect(0,0, 10000, 8000);
      }
      void drawBackground(QPainter * p, const QRectF&) {
      
      p->setWorldMatrixEnabled(false);
      p->setViewTransformEnabled(false);
      QFont f("Arial");
      f.setPixelSize(64);
      p->setFont(f);
      p->drawText(QPoint(10,100),"Hello");
      p->setWorldMatrixEnabled(true);
      p->setViewTransformEnabled(true);
      }
      };
      
      int main(int argc, char** argv)
      {
      QApplication app(argc,argv);
      View *v = new View();
      v->show();
      app.exec();
      return 0;
      }
      

      Copying some lines from Qt 4.7 PaintEngine fixes the issue. Patch attached. Can't guarantee if patch cause some side-effects in Qt 4.8.

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

            andysh Andy Shaw
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes