Nominate our 2022 Qt Champions!

Shadow for Rectangle and Circle.

  • How will shadow create for Ractangle and Circle by means of DropShadow that happen like this

    I do so:

    Item {
        Rectangle {
            id: rect
            anchors.fill: parent
        DropShadow {
            anchors.fill: rect
            radius: 18.0
            samples: 16
            color: "#80000000"
            source: rect

    but it do not work.

  • use RectangularGlow instead.

  • Well, first you need to enable layer and then set layer effect by DropShadow for example check my sample:

     layer.enabled: true
            layer.effect: DropShadow {
                horizontalOffset: 0;
                radius: 8
                samples: 16
                source: {YourRectangleId}
                color: "#20000000"
                verticalOffset: 0;
                transparentBorder: true
                spread: 0

Log in to reply