[Interest] React to signal only when at top of StackView

Elvis Stansvik elvstone at gmail.com
Sat May 7 10:38:29 CEST 2016


2016-05-07 10:20 GMT+02:00 J-P Nurmi <jpnurmi at qt.io>:
>> On 06 May 2016, at 23:27, Elvis Stansvik <elvstone at gmail.com> wrote:
>>
>> 2016-05-06 22:41 GMT+02:00 J-P Nurmi <jpnurmi at qt.io>:
>>>
>>>
>>> The Stack.status property must be attached to an item that is in a StackView. In the snippet above, it is attached to the Connections element. You can give the Rectangle element an id to be able to attach the property to it instead.
>>>
>>>            initialItem: Rectangle {
>>>               id: rect // <==
>>>               anchors.fill: parent
>>>               color: "green"
>>>               Connections {
>>>                   target: rect.Stack.status === rect.Stack.Active ? button : null // <==
>>
>> BTW, out of curiosity, do you know why the above works, but not:
>>
>>                   target: parent.Stack.status === parent.Stack.Active
>> ? button : null // <==
>>
>> ?
>>
>> Elvis
>
> Hi, it’s because ‘parent’ is a property of Item, but Connections is not an Item.

Ah yes, of course. Thanks.

I think I was confused because Qt Creator made parent italic when I
wrote it like that, as if it was defined, and I got no errors when
running. I couldn't get that behavior in a simple testcase though, so
not sure why it thought parent was defined there (following the symbol
with F2 did nothing).

Elvis

>
> --
> J-P Nurmi
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list