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

Text layout is updated inconsistently with transforms

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.6.3
    • GUI: Text handling
    • None

    Description

      When text is rotated, the layout seems to be updated to snap to grid, which gives "jumping" text while the text is rotating. The effect is quite ugly for animation.

      The problem can clearly be seen on the webpage http://webkit.org/blog-files/pulse.html
      With Chrome or Safari, the text is ok during the animation. With Qt, each characters seems to jump around during the transformation. (The original bug report for WebKit is https://bugs.webkit.org/show_bug.cgi?id=32404 ).

      Here is a reduction without showing the problem outside WebKit:

      #include <QtGui>
      
      class Widget : public QWidget
      {
      public:
          Widget()
            : m_rotationAngle(0)
          {
              startTimer(16);
          }
      protected:
          void paintEvent(QPaintEvent *)
          {
              QPainter painter(this);
              painter.translate(200.f, 150.f);
              painter.rotate(m_rotationAngle);
              QFont textFont("Times");
              textFont.setPixelSize(16);
              painter.setFont(textFont);
              painter.drawText(QPointF(-50, 0), QString("Some text is there YEEAAAAh"));
          }
      
          void timerEvent(QTimerEvent *)
          {
              m_rotationAngle += 0.5f;
              update();
          }
      private:
          qreal m_rotationAngle;
      };
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          Widget widget;
          widget.show();
          return app.exec();
      }
      

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes