| 1 |
import QtQuick 2.0 |
| 2 |
|
| 3 |
Item { |
| 4 |
width: 320 |
| 5 |
height: 480 |
| 6 |
|
| 7 |
Rectangle { |
| 8 |
id: draggee |
| 9 |
width: 200 |
| 10 |
height: 80 |
| 11 |
x: 100 |
| 12 |
y: 360 |
| 13 |
gradient: Gradient { |
| 14 |
GradientStop { position: 0.0; color: "steelBlue" } |
| 15 |
GradientStop { position: 0.49; color: "white" } |
| 16 |
GradientStop { position: 0.5; color: "gray" } |
| 17 |
GradientStop { position: 1.0; color: "darkGray" } |
| 18 |
} |
| 19 |
radius: 20 |
| 20 |
border.width: 2 |
| 21 |
border.color: "black" |
| 22 |
Text { |
| 23 |
anchors.centerIn: parent |
| 24 |
font.pixelSize: 40 |
| 25 |
text: "Position 2" |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
ShaderEffectSource { |
| 30 |
id: source |
| 31 |
sourceItem: draggee |
| 32 |
hideSource: true |
| 33 |
property real margins: 6 |
| 34 |
sourceRect: Qt.rect(-margins, -margins, sourceItem.width + 2 * margins, sourceItem.height + 2 * margins) |
| 35 |
smooth: true |
| 36 |
} |
| 37 |
|
| 38 |
ShaderEffect{ |
| 39 |
id: effect |
| 40 |
anchors.fill: source.sourceItem |
| 41 |
anchors.margins: -source.margins |
| 42 |
property variant source: source |
| 43 |
property variant offset: Qt.size(4 / width, 4 / height) |
| 44 |
property variant delta: Qt.size(0.5 / width, 0.5 / height) |
| 45 |
|
| 46 |
fragmentShader: "qrc:shaders/shadow.frag" |
| 47 |
} |
| 48 |
} |