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

Drawing text with an extremely transformed painter can take very long and consume a lot of memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • Some future release
    • 4.2.2
    • GUI: Painting
    • None

    Description

      Reproducible with the following example. In the beginning the 'o' shows correctly, but if the height of the window is increased the 'o' will disappear, and the process will consume more and more memory, before coming to practically complete stop.

      The same code using font.setPixelSize(1) works.

      #include <QtGui>

      class Widget : public QWidget
      {
      public:
      Widget()
      {
      }

      protected:
      void paintEvent(QPaintEvent *e)

      { QPainter painter(this); // logical coordinates from -1 to 1 painter.setWindow(-1, -1, 2, 2); // mapped to the whole widget painter.setViewport(rect()); // cosmetic pen to avoid transformation painter.setPen(QPen(Qt::black, 0)); painter.drawLine(-1, 0, 1, 0); painter.drawLine(0, -1, 0, 1); QFont font; font.setPointSizeF(0.002); //font.setPixelSize(1); painter.setFont(font); painter.drawText(0, 0, "o"); }

      };

      int main(int argc, char **argv)
      {
      QApplication a( argc, argv );

      Widget widget;
      widget.resize(125, 50);
      widget.show();

      return a.exec();
      }

      Attachments

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

        Activity

          People

            shausman Simon Hausmann
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes