[Interest] Draw a shadow around a Rectangle using DropShadow. Should be possible, right?

Mark Gaiser markg85 at gmail.com
Wed Feb 5 15:31:14 CET 2014


I "thought" i could just use any of the QtGraphicalEffects and apply
them to any item.
But when i try to apply a simple shadow to a rectangle (or a glow) i
don't get any shadow. Instead, the destination rectangle simply gets
filled with the color i provided as shadow.

In case it matters.
Nvidia (binary blob) on Linux (ArchLinux).

I'm really curious to know why this isn't working properly.
It doesn't seem to be an issue on images elements...

The code isn't big so i'm just posting it in this mail:

import QtQuick 2.0
import QtGraphicalEffects 1.0

Rectangle {
    width: 800
    height: 600

        id: brContainer
        width: 500 + 16
        height: 50 + 16
        anchors.centerIn: parent
        border.color: "red"
        border.width: 1

        Rectangle {
            id: blackRect
            width: 500
            height: 50
            color: "black"
            anchors.centerIn: parent

    DropShadow {
        anchors.fill: brContainer
        horizontalOffset: 3
        verticalOffset: 3
        radius: 16
        samples: 24
        color: "#80000000"
        source: blackRect

More information about the Interest mailing list