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

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

XMLWordPrintable

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

      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

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

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

              Created:
              Updated:

                There are no open Gerrit changes