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

Qt Text with Native Rendering fails with when colour has alpha set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.0
    • None
    • Linux, XCB

    Description

      When a Text element is used with color:  Qt.rgba(r,g,b,0.5)   the blending behaviour is not applied correctly. Even if the text element is over a solid background the final texel in the framebuffer in additon to being blended with the RGB of the background ends up with an alpha of 0.5, which is unexpected. This causes a problem when used with a window that has a transparent background.

       

      The following should all look the same. In practice, the top will will appear white when the window is above a white background, the rest are all grey.

              Text {
                  text: "Native with alpha in colour"
                  font.pixelSize: 20
                  color: Qt.rgba(0,0,0,0.5)
                  renderType: Text.NativeRendering
                  opacity: 1.0
              }
              Text {
                  text: "Native with opacity"
                  font.pixelSize: 20
                  color: Qt.rgba(0,0,0, 1)
                  opacity: 0.5
                  renderType: Text.NativeRendering
              }
              Text {
                  text: "Qt with alpha in colour"
                  font.pixelSize: 20
                  color: Qt.rgba(0,0,0,0.5)
                  renderType: Text.QtRendering
                  opacity: 1.0
              }
              Text {
                  text: "Qt with opacity"
                  font.pixelSize: 20
                  color: Qt.rgba(0,0,0, 1)
                  opacity: 0.5
                  renderType: Text.QtRendering
              }

       

      Demo cpp attached

      Attachments

        1. qmltextopacitytest.tar.gz
          642 kB
          David Edmundson
        2. Screenshot_20180823_114101.png
          24 kB
          David Edmundson
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            davidedmundson David Edmundson
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes