GridView delegate z-ordering problem



  • Hi,

    I have a GridView which demonstrates a problem I'm having with delegate z-ordering.

    GridView{
    id:gridView
    anchors.fill: parent
    cellWidth:150
    cellHeight:150
    clip:true
    delegate:Rectangle{
    id:bottom
    z:0
    width:140
    height:140
    x:5
    y:5
    border.width: 1
    border.color: 'white'
    color:'darkblue'
    clip:false
    Rectangle{
    id:top
    color:'red'
    opacity:0.7
    width:200
    height:100
    z:1
    anchors.centerIn: parent
    border.color: 'white'
    border.width: 1
    rotation: 8.4
    }
    }
    }

    Newly created delegates always overlap previous ones, this becomes noticeable when scrolling up or down. What I would like to achieve is to have the top item of a delegate always displayed on top of the bottom item of adjacent delegates.

    I can hide the problem by making sure the top item never underlaps another bottom item, but I would like to know if I can solve it by enforcing a z-order among delegates.



  • use the following, in the first Rectangle to give your items a reversed z-order and loose the z: 1 in the inner Rectangle

    @z: model.count - index@



  • "SQEW":http://qt-project.org/member/139622, if your Question is solved, please add the "solved" tag and rename the title of your post, so it starts with "[solved]"


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.