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

Fix API flaw for QImage::mirror and QImage::mirrored

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.9.0 FF
    • 6.0.0, 6.9.0 FF
    • GUI: Painting
    • None
    • 577946c1f (dev), 3f1a644ee (dev), 24fb49232 (dev), 8e7847bc3 (dev), b89634bc2 (dev), f277c2182 (dev)

    Description

      I suppect newly (Qt6) introduced mirror function was made like mirrored to be similar, but to be very honest believe this is a step in the wrong direction. We ought to deprecate the existing mirror functions and use Qt::Orientations as arguments instead.

      Motivation: That something has been a wrong way for a long time is not a reason not to fix it (when it is very wrong) and I had a codereview in some code using QImage::mirror and the result is unreadable code. Now, I didn't think exactly this, but I believe it will be prefectly acceptable to think the below:

      void someFunction(QImage &img) 
      {
        img.mirror(true); // Now the image is mirrored, right
        callSomeOtherFunction(image);
        img.mirror(true); // We ensure image is still mirrored (in case the above function changes something)
        callAthridFuncttion(image); 
        img.mirror(false); // Ensure the image isn't mirrored anymore
        // do something more
      }
      

      I suggest that the API for mirror (and mirrored) is changed to use Qt::Orientations and that the existing mirror versions are deprecated (lastest in Qt7 and later removed - preferable in Qt7 but latest in Qt8).

      Attachments

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

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            tmartsum Thorbjørn Lund Martsum
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: