[Interest] Attached properties with Namespaced imports

Shantanu Tushar shaan7in at gmail.com
Fri Jan 27 18:47:53 CET 2017


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



More information about the Interest mailing list