[Interest] QML innershadow

hualet mr.asianwang at gmail.com
Wed Dec 17 15:50:30 CET 2014


Hi Buti,

maybe the proper way to achieve the same effect is like this:

import QtQuick 2.0
import QtGraphicalEffects 1.0

Item {
   id: root
   width: 300
   height: 300

   Item {
       id: src
       anchors.fill: parent

       Rectangle {
           id: myRectangle
           anchors.centerIn: parent
           width: 100
           height: 100
           color: "grey"
       }
   }

   InnerShadow {
       anchors.fill: src
       cached: true
       horizontalOffset: 0
       verticalOffset: 0
       radius: 16
       samples: 32
       color: "#b0000000"
       smooth: true
       source: src
   }
}

my suggestion is that you should definitely follow the documentation, otherwise you will be confused by the strange effect caused by applying effect on the effect’ parent someday in the future ;)


More information about the Interest mailing list