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

Suggestion for appending to QPicture

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • Some future release
    • 4.2.2
    • GUI: Painting
    • None

      Currently it is not possible to append to a QPicture.

      Anytime you call begin on a QPicture painter, it destroys all the old data. The only way to add to a QPicture currently is to create a new QPicture, play the existing QPicture that you want to append to, then paint the new data. This is slow and inefficient.

      The problem can be demonstrated using the following code:
      #include <QtGui>
      #include <QDebug>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QPicture pixmap;

      { QPainter painter(&pixmap); QLineF line(10.0, 80.0, 90.0, 20.0); painter.drawLine(line); } { QPainter painter2(&pixmap); QLineF line2(13.0, 50.0, 60.0, 20.0); painter2.drawLine(line2); }

      QPainter painter3;
      painter3.begin((QPaintDevice *) &pixmap);
      QLineF line3(5.0, 60.0, 30.0, 10.0);
      painter3.drawLine(line3);
      painter3.end();

      QPixmap pix(100,100);
      QPainter pixpainter(&pix);
      pixpainter.drawPicture(0, 0, pixmap);

      QLabel label;
      label.setPixmap ( pix);
      label.show();

      return app.exec();

      }

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

            sletta Gunnar Sletta
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes