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

Resizing IconImage changes it's actual color if `color` is translucent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.11.2
    • 5.10.0, 5.10.1, 5.11.0, 5.11.1
    • Quick: Controls 2
    • None
    • openSUSE Tumbleweed 20180712
      Android 8.1 (NDK 17.1.4828580, clang, ARM64)
    • 12a08ee8eaa27be7dc500b1c15348e8f692949dc

    Description

      Steps to reproduce:

      1. Run bug.qml from attached zip using qmlscene
      2. Shrink the window so that the star has to shrink too
      3. Enlarge the window to (approximately) it's original size
      4. Notice that the star has became more translucent than it was originally (screenshot-bad.png)
      5. Click anywhere inside the window
      6. Notice that the star has returned to it's original color (screenshot-good.png)

      It looks like when IconImage is resized and then returned to it's initial size, it applies the tint color (IconImage::color property) the second time. This has no effect if the tint color is opaque, but if it is translucent, then the whole image becomes more translucent. Only the actual color (i.e. as seen on screen) of the image changes, the value of IconImage::color stays the same.

      In some cases the initial actual color of the image is already wrong. You can reproduce that by commenting out the sourceSize line in bug.qml.

      The workaround is to change the value of IconImage::color to some other value and then to change it back (this is what clicking the window does). IIRC changing values of IconImage::source or IconImage::name back and forth works too.

      I have observed this bug on Linux and on Android (attached example was tested only on Linux). According to comments in my project, the bug is as old as IconImage itself (i.e. since Qt 5.10.0).

      That being said, of course IconImage is not a public API. However, this behavior can be seen in several AbstractButton derived public API types (e.g. ItemDelegate and ToolButton). But i have tracked the problem down to IconImage.

      Attachments

        For Gerrit Dashboard: QTBUG-69506
        # Subject Branch Project Status CR V

        Activity

          People

            mitch_curtis Mitch Curtis
            vovams Vova Mshanetskiy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes