Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    How to create property under property ?

    QML and Qt Quick
    2
    2
    1679
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      zanes last edited by

      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

      1 Reply Last reply Reply Quote 0
      • A
        andre last edited by

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post