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

ListView highlight should support rendering between "layers" of a delegate

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      Currently a ListView highlight must appear either completely under or completely over a delegate. That makes it difficult for delegates that are designed with both a foreground and background. For example, the following is intended to show the highlight over the background Rectangle, but under the foreground Text (so the Text always appears white):

      import QtQuick 2.14
      
      ListView {
          width: 400
          height: 400
          spacing: 2
          model: 10
          delegate: Item {
              width: parent.width
              height: 50
      
              // background
              Rectangle {
                  anchors.fill: parent
                  color: "steelblue"
              }
      
              // foreground
              Text {
                  anchors.centerIn: parent
                  color: "white"
                  text: "Item " + model.index
              }
      
              TapHandler { onTapped: currentIndex = model.index }
          }
      
          // this highlight should appear over the delegate background, but under the delegate foreground
          highlight: Rectangle {
              color: "#80FF0000"
              z: 2
          }
      }

       

      While this could be addressed at the view level, it might be interesting to support more generically as well. For example, I could imagine API like:

      Item {
          width: 400
          height: 400
          
          Rectangle {
              RenderLayer.target: "foregroundLayer"
          }
          
          Rectangle {
              RenderLayer.target: "backgroundLayer"
          }
      
          RenderLayer { name: "backgroundLayer" }
          RenderLayer { name: "foregroundLayer" }
      } 

      where any item could receive transforms, etc from the normal parent chain, but a custom, "global z value" based on RenderLayer.

        Attachments

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

          Activity

            People

            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              mbrasser Michael Brasser
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes