How to create property under property ?



  • Hi All,

    How do i create a property which is under another property?
    please check the sample code below,
    May be its not property under property.. its a class and subclass.

    @
    Class C1{
    Q_PROPERTY(C2 t1 READ t1 NOTIFY elementNameChanged)
    }

    Class C2{
    Q_PROPERTY(QVariant height READ height NOTIFY elementNameChanged)
    }

    //In qml

    import C1 1.0
    import C2 1.0

    Item{

    C1{
    id:idC1
    Component.onCompleted:idC2 = idC1.t1
    }
    C2{
    id:idC2
    }

    Rectangle{
    height: idC2.height
    }

    }

    //The above code works fine.

    //But i like to have in the Rectangle like this
    Rectangle{
    height: idC1.idC2.height
    }
    // what should i need to change to achieve the above way of access ?
    @

    Thanks



  • That is only possible, if C1 is a QObject itself.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.