problem anchoring MultiEffect
-
Hi all -
My application calls for use of the same shadow on many different components. To avoid duplicating code, I created a component to perform the shadowing:
// Shadow.qml import QtQuick import QtQuick.Effects MultiEffect { required property var shadowTarget source: shadowTarget anchors.fill: shadowTarget ... // a bunch of stuff }This works fine when applied to rectangles and buttons, but when I try to use it on a Pane:
// Shadow user Item { Pane { id: myPane } Shadow { shadowTarget: myPane } }I get an error: "QML MultiEffect: Cannot anchor to an item that isn't a parent or sibling."
Is there something unique about a Pane that would prevent this from working? It's kind of an odd error message.
Thanks...
-
Hi all -
My application calls for use of the same shadow on many different components. To avoid duplicating code, I created a component to perform the shadowing:
// Shadow.qml import QtQuick import QtQuick.Effects MultiEffect { required property var shadowTarget source: shadowTarget anchors.fill: shadowTarget ... // a bunch of stuff }This works fine when applied to rectangles and buttons, but when I try to use it on a Pane:
// Shadow user Item { Pane { id: myPane } Shadow { shadowTarget: myPane } }I get an error: "QML MultiEffect: Cannot anchor to an item that isn't a parent or sibling."
Is there something unique about a Pane that would prevent this from working? It's kind of an odd error message.
Thanks...
@mzimmers said in problem anchoring MultiEffect:
QML MultiEffect: Cannot anchor to an item that isn't a parent or sibling.
Pane and Shadow do not have parent and child relationship.
anchors.fill: shadowTarget ==>not allowed.The following works.
Rectangle { id: parentRect width: 200 height: 200 Rectangle { id: childRect width: 100 height: 100 color: "blue" anchors.centerIn: parentRect } } -
@mzimmers said in problem anchoring MultiEffect:
QML MultiEffect: Cannot anchor to an item that isn't a parent or sibling.
Pane and Shadow do not have parent and child relationship.
anchors.fill: shadowTarget ==>not allowed.The following works.
Rectangle { id: parentRect width: 200 height: 200 Rectangle { id: childRect width: 100 height: 100 color: "blue" anchors.centerIn: parentRect } } -
@JoeCFD said in problem anchoring MultiEffect:
Pane and Shadow do not have parent and child relationship
But in my example, they're siblings, aren't they? The same coding works with buttons; I don't understand why it doesn't work with a Pane.