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

TextInput.selection color doesn't blend properly when alpha is 0

XMLWordPrintable

    • bf8b45e33af960c03c7dccf56e90e76eda1f510e (qt/qtdeclarative/dev) 4f5648478e8f4dd52cfba480980f1a000ff3b3fd (qt/qtdeclarative/5.15)

      When the alpha component of selectionColor is set to 0, the blending seems to be disabled for TextInput. This leads to black selection being shown no matter what color is assigned to selectionColor as long as it's alpha is 0.

      The sample application is attached: SelectionBug.tar.gz

      On the screenshot below you can see 3 example of wrong behavior (on the left) and 2 examples of right behavior together with 2 workarounds (on the right).

      On the right top two instances use red selection color with varying transparency. As you can see, even the value of int(1) is enough to enable blending and get visually satisfactory result.

      The third example demonstrates that changing opacity to a value less than 1 also forces blending.

      The last example strengthens the theory of disabled blending by the evidence that we in fact have transparent pixels rendered in TextInput because if we redirect them to a ShaderEffect we get proper transparency. ShaderEffectSource used here is attached to the top left TextInput and you can see that they have identically selected text.

       

      You can interact with all TextInputs in the attached sample to change the selections. Changing the text in the bottom-most text box will autoselect all TextInputs.

        1. 2020-04-27-192139_400x150_scrot.png
          21 kB
          Nikolai Gubarev
        2. SelectionBug.tar.gz
          0.8 kB
          Nikolai Gubarev
        For Gerrit Dashboard: QTBUG-83819
        # Subject Branch Project Status CR V

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            beefc0deh Nikolai Gubarev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes