Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to create property under property ?

How to create property under property ?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.8k Views
  • 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 Offline
    Z Offline
    zanes
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved