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

QPainter warnings when QDrag exec() called without setting a valid Pixmap

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • 5.1.0 Beta 1
    • 5.0.0
    • GUI: Drag and Drop
    • None
    • Ubuntu, Xcb
    • 3a2b3fc0d72fe1e52a7830e03f849963f6b73e02

      1) Run the provided test code;

      Expected: no error messages in the console
      Actual:

      QPainter::begin: Paint device returned engine == 0, type: 3
      QPainter::setCompositionMode: Painter not active
      QPainter::begin: Paint device returned engine == 0, type: 3
      QPainter::setCompositionMode: Painter not active
      QPainter::begin: Paint device returned engine == 0, type: 3
      

      TEST CODE:

      class Widget : public QLabel
      {
          Q_OBJECT
      public:
          Widget():QLabel()
          {
              if (pix.load("logo.png"))
                  qDebug() << "pixmap loaded";
              else
                  qDebug() << "failed to load pixmap";
      
              setPixmap(pix);
          }
      
      protected:
          void mousePressEvent(QMouseEvent *ev)
          {
              QMimeData *mimeData = new QMimeData;
              mimeData->setImageData(pix.toImage());
      
              QDrag *drag = new QDrag(this);
              drag->setMimeData(mimeData);
              //drag->setPixmap(pix); // add this line to suppress QPainter warnings 
      
              drag->exec();
          }
      
      private:
          QPixmap pix;
      
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          Widget wid;
          wid.show();
          
          return a.exec();
      }
      

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

            paeglis Gatis Paeglis
            paeglis Gatis Paeglis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes