[QT Bug? ] Layering of custom QQuickItem-based qml item and built-in qml items



  • Hello,

    I have a problem that I am trying to solve and I've now started to believe its a bug.
    I have created an item named "Node" that is derived from QQuickItem and draws a circle.

    If I do something like:

    @
    Item {
    Rectangle {
    x: 50
    y: 50
    width: 100
    height: 100
    color: "#FFFF0000"
    }

    Node {
        x: 100
        y: 100
        radius: 20
        color: "#FFFFCC00"
    }
    

    }
    @

    The Node item is drawn below the Rectangle which is not what is expected. The ordering doesn't change even if I change the z-value of the Node.

    If I do something like:

    @
    Item {
    Node{
    x: 50
    y: 50
    radius: 100
    color: "#FFFF0000"
    }

        Node {
            x: 100
            y: 100
            radius: 20
            color: "#FFFFCC00"
        }
    }
    

    @
    Then the expected ordering is followed.
    Could this be a QT bug or am I making some silly mistake??

    Thanks!

    -Nik.


  • Moderators

    Interesting. What happens when you do this (reparent Node as a kid of Rectangle):
    @
    Rectangle {
    x: 50
    y: 50
    width: 100
    height: 100
    color: "#FFFF0000"

    Node {
        x: 100
        y: 100
        radius: 20
        color: "#FFFFCC00"
    }
    

    }
    @



  • Trying this:

    @ Rectangle {
    x: 50
    y: 50
    width: 100
    height: 100
    color: "#FFFF0000"

        Node {
            x: 80
            y: 80
            radius: 20
            color: "#FFFFCC00"
        }
    }
    

    @

    Still renders Node behind the rectangle...

    Edit:
    I just submitted the problem to the QT Bug Tracker: https://bugreports.qt-project.org/browse/QTBUG-31043
    Hopefully this will get a high priority and will get fixed soon...

    -Nik.


Log in to reply
 

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