[Interest] Attached properties with Namespaced imports

J-P Nurmi jpnurmi at qt.io
Fri Jan 27 19:33:53 CET 2017


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



More information about the Interest mailing list