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

QImageWriter has confusing docs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 6.8.2
    • GUI: Other
    • None

    Description

      The docs say:

      QImageWriter::UnknownError
      
      An unknown error occurred. If you get this value after calling write(), it is most likely caused by a bug in QImageWriter. 

      {}I always get this error after calling write().  This value is the default value of the error variable. If there is no error, UnknownError is always returned.

       

      Example:

      #include <QtGui/QImage>
      #include <QtGui/QImageWriter>int main()
      {
          QImage img(10, 10, QImage::Format_ARGB32);
          img.fill(Qt::red);    QImageWriter w("out.png");
          Q_ASSERT(w.canWrite());
          w.write(img);
          // Write succeeded, but we still have UnknownError which is bad according to the docs
          qDebug() << "Error: " << (w.error() == QImageWriter::UnknownError) << w.errorString();    return 0;
      } 

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            waqar Waqar Ahmed
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes