Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Allow Item components to be assigned to Item.layer.effect.
Some complex effects are easier to implement as Items using ShaderEffects internally rather than with a top-level ShaderEffect. Auto-tests added. Change-Id: I4b99811b87e7ca5054bf119b99207b7f5a7c666e Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
- Loading branch information
Kim Motoyoshi Kalland
authored and
Qt by Nokia
committed
Feb 7, 2012
1 parent
b057ac0
commit 5cc1870
Showing
6 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import QtQuick 2.0 | ||
|
||
Item { | ||
width: 200 | ||
height: 200 | ||
Rectangle { | ||
anchors.fill: parent | ||
anchors.margins: 99 | ||
gradient: Gradient { | ||
GradientStop { position: 0.3; color: "red" } | ||
GradientStop { position: 0.7; color: "blue" } | ||
} | ||
layer.enabled: true | ||
layer.effect: Item { | ||
property variant source | ||
ShaderEffect { | ||
anchors.fill: parent | ||
anchors.margins: -99 | ||
property variant source: parent.source | ||
} | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/auto/qtquick2/qquickitemlayer/data/RectangleEffect.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import QtQuick 2.0 | ||
|
||
Item { | ||
width: 200 | ||
height: 200 | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
x: 50 | ||
y: 50 | ||
scale: 1.5 | ||
z: 1 | ||
rotation: 45 | ||
color: "#ff0000" | ||
layer.enabled: true | ||
layer.effect: Rectangle { color: "#0000ff" } | ||
} | ||
Rectangle { | ||
anchors.fill: parent | ||
color: "#00ff00" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters