[Interest] Attached properties with Namespaced imports

Shantanu Tushar shaan7in at gmail.com
Fri Jan 27 19:45:06 CET 2017


Hi,

Ah I think I made a typo while preparing the code snippet. I tried
what you suggested as well, doesn't work.

Also, something I just noticed in GammaRay, "QQuickStackAttached" is
missing in the properties list for the Rectangle in the code sample
which doesn't work. Here's a screenshot http://i.imgur.com/OEVZQZA.png


On Sat, Jan 28, 2017 at 12:03 AM, J-P Nurmi <jpnurmi at qt.io> wrote:
> Hi,
>
> Try this:
>
>     C2.StackView.onStatusChanged: console.log("Status is " + C2.StackView.status)
>
> --
> J-P Nurmi
>
>> On 27 Jan 2017, at 18:48, Shantanu Tushar <shaan7in at gmail.com> wrote:
>>
>> Hi,
>>
>> I realized today that this doesn't work-
>>
>> import QtQuick 2.7
>> import QtQuick.Controls 2.1 as C2
>>
>> C2.ApplicationWindow {
>>    visible: true
>>    width: 640
>>    height: 480
>>
>>    C2.StackView {
>>        anchors.fill: parent
>>
>>        Component.onCompleted: push(rectComponent)
>>    }
>>
>>    Component {
>>        id: rectComponent
>>
>>        Rectangle {
>>            color: "green"
>>            C2.StackView.onStatusChanged: console.log("Status is " +
>> StackView.status)
>>        }
>>    }
>> }
>>
>> "Status is" is never printed. However if I import without the "as C2"
>> and use "StackView.onStatusChanged", the message is printed.
>>
>> The reason I need to do this is that we are still using QtQuick
>> Controls 1 throughout our project and want to use StackView from
>> QtQuick.Controls 2 because we need the "StackView.onRemoved"
>> functionality.
>>
>> Any idea how to make the attached property's signal work?
>>
>> Cheers,
>>
>> --
>> Shantanu Tushar    (UTC +0530)
>> shantanu.io
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest



-- 
Shantanu Tushar    (UTC +0530)
shantanu.io
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OEVZQZA.png
Type: image/png
Size: 195725 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170128/20645a3f/attachment.png>


More information about the Interest mailing list