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

Failure with QGraphicsPixmapItem::setOpacity and ::setVisible

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.2, 5.12
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      OS X 10.12.6, Qt 5.11.2
    • Platform/s:
      macOS

      Description

      There is a strange bug specific to OS X for Qt 5.11.2 (the bug does not exist in the older Qt 5.7.1 and does not occur on Windows or Linux for Qt 5.11.2).

      1. A QGraphicsPixmapItem becomes distorted (see screenshot 3) when calling QGraphicsPixmapItem::setOpacity() with opacity between 0.5 and 1.0. No distortion is noticeable when the opacity is <= 0.5.
      2. QGraphicsPixmapItem::setVisible(false) does not make the QGraphicsPixmapItem completely invisible. It is still partially visible until the underlying scene is updated a few more times.

      I am using OS X 10.12.6. This issue does not occur on Linux or Windows, just OS X.

      I have attached 3 screenshots:
      Screenshot 1. (as expected) a pixmap with opacity set to 0.5 using Qt 5.11.2
      Screenshot 2. (as expected) a pixmap with opacity set to 1.0 using Qt 5.7.1
      Screenshot 3. (unexpected) a pixmap with opacity set to 1.0 using Qt 5.11.2. The image is distorted and and smaller pixmaps which were set to invisible can still be seen (note images).

      The pixmap is created with the following code:

      std::vector<uint32_t> color_data;
      // ... [fill color_data]
      QImage image = QImage((const uchar*)&color_data.at(0), width, height, QImage::Format_RGB32).transformed(QMatrix().rotate(270));
      QPixmap pixmap;
      pixmap.convertFromImage(image);
      pixmaps_.push_back(pixmap);

        Attachments

        1. Screenshot1_OSX_Qt5.11.2_opacity=0.5.png
          113 kB
          Timothy Watson
        2. Screenshot2_OSX_Qt5.7.1_opacity=1.0.png
          115 kB
          Timothy Watson
        3. Screenshot3_OSX_Qt5.11.2_opacity=1.0.png
          47 kB
          Timothy Watson
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              vgt Eirik Aavitsland
              Reporter:
              quakkp Timothy Watson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes