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

[REGRESSION] QWidget::grab() ignores alpha and QGraphicsEffect

    XMLWordPrintable

Details

    • 9e81fb4df6809bb2ff909af595ac9e2487760181

    Description

      Critical regression that breaks almost everything into my application was introduced by Qt 5.4.

      QWidget::grab() has 2 issues.
      I have a label with a PNG with alpha set as QLabel's pixmap.

      In 5.3, label.grab() returns the pixmap with the proper alpha set in it, and if I save it, the alpha is there. In 5.4, alpha is completely ignored, and grabbed image is opaque.

      Then, I set QGraphicsEffect on this QLabel. label.grab() then returns completely empty transparent image. In qt 5.3, the image returned was original translucent image with QGraphicsEffect applied to it (and its alpha there)

      Given the very bad design decision for QGraphicsEffect itself and the grab() regression, I am now unable to generate translucent images with drop-shadows unless I implement convolution kernel filter by myself, which I want to avoid at all costs! As a side feature request, app QGraphicsEffect::ApplyToPixmap / ApplyToImage API so we can use these great effects on something different than QWidgets / QGraphicsViews. Nor I can hack the draw() call on the QGraphicsEffects, because sourcePixmap() call should actually was argument to the draw call (Design flaw by itself)

      You should also add an unit test for grabbing translucent pixmaps from QWidget with QGraphicsEffect set.

      For now, this issue is MAJOR SHOWSTOPPER here and I will return to 5.3 immediately.

      Attached is example project

      Attachments

        1. GERenderer.zip
          4 kB
        2. qtbug43968.zip
          4 kB

        Issue Links

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

          Activity

            People

              tvete Paul Olav Tvete
              petersvp Peter Petrov
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes