title: Correct way to get the height of an Item based on it's contents in qml?
body: <p>This maybe a silly question, but im developing an accordion like component, where i pass with the property <code>content</code> the contents i want it to have.
  the problem is when i click on the element when it opens i'm not finding how i can get the height of those items.</p>
  
  <p>An example when its closed:</p>
  
  <p><a href="https://i.stack.imgur.com/BeM93.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BeM93.png" alt="enter image description here"></a>
  example when open:</p>
  
  <p><a href="https://i.stack.imgur.com/j61fB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j61fB.png" alt="enter image description here"></a></p>
  
  <p>Here we see that <code>panel 2</code> component should go down</p>
  
  <p>The code in <code>main.qml</code> is:</p>
  
  <pre><code>import QtQuick 2.7
  import QtQuick.Dialogs 1.2
  import QtQuick.Layouts 1.3
  import QtQuick.Controls 2.3
  import QtQuick.Window 2.3
  
  ApplicationWindow {
      visible: true
      width: 640
      height: 480
      title: qsTr("Tabbars")
  
      Rectangle{
          anchors.fill:parent
          PanelItem {
              id:panel1
              title: "Panel 1"
              anchors.top:parent.top
              anchors.left:parent.left
              anchors.right:parent.right
              content: Item {
                  property string title: "teste"
                  anchors.fill:parent
                  height:configContent.implicitHeight
                  ColumnLayout{
                      id:configContent
                      anchors.fill:parent
                      TextField {
                          id: companyNameText1
                          placeholderText: qsTr("Company name")
                          Layout.fillWidth: true
                          selectByMouse: true
                      }
                      ComboBox {
                          id: languagesComboBox1
                          textRole: "text"
                          objectName: "language"
                          Layout.fillWidth: true
                          model: ListModel {
                              ListElement {text: QT_TR_NOOP("English"); oid: 0}
                              ListElement {text: QT_TR_NOOP("Portuguese"); oid: 1}
                              ListElement {text: QT_TR_NOOP("Spanish"); oid: 2}
                              ListElement {text: QT_TR_NOOP("Italian"); oid: 3}
                              ListElement {text: QT_TR_NOOP("French"); oid: 4}
                              ListElement {text: QT_TR_NOOP("Portuguese(Brasil)"); oid: 5}
                          }
                      }
                      ComboBox {
                          id: devSndrModeComboBox1
                          textRole: "text"
                          objectName: "test_dev_sndr_mode"
                          Layout.fillWidth: true
                          model: ListModel {
                              Component.onCompleted: {
                                  append({ text: QT_TR_NOOP("None"), oid: 0 })
                                  append({ text: QT_TR_NOOP("Subpanel"), oid: 1 })
                                  append({ text: QT_TR_NOOP("All"), oid: 2 })
                              }
                          }
                      }
                  }
              }
              Component.onCompleted: {
                  resetOtherAccordions.connect(panel2.resetHeight)
                  console.log("panel 1 height "+panel1.height)
              }
          }
          PanelItem {
              id:panel2
              title: "Panel 2"
              anchors.topMargin: 5
              anchors.top:panel1.bottom
              anchors.left:parent.left
              anchors.right:parent.right
              content: Item {
                  property string title: "teste"
                  anchors.fill:parent
                  height:configContent2.implicitHeight
                  ColumnLayout{
                      id:configContent2
                      anchors.fill:parent
                      ComboBox {
                          id: sndrModeComboBox1
                          textRole: "text"
                          Layout.fillWidth: true
                          model: ListModel {
                              Component.onCompleted: {
                                  append({ text: QT_TR_NOOP("Preset"), oid: 0 })
                                  append({ text: QT_TR_NOOP("Programmed"), oid: 1 })
                              }
                          }
                      }
                  }
              }
              Component.onCompleted: {
                  resetOtherAccordions.connect(panel1.resetHeight)
                  console.log("panel 2 height "+panel2.height)
              }
          }
  
  
      }
  }
  </code></pre>
  
  <p>the code in <code>PanelItem.qml</code></p>
  
  <pre><code>import QtQuick 2.7
  import QtQuick.Layouts 1.2
  
  Item {
      default property var contentItem: null
      property Component content
      property string title: "panel"
      id: root
      height: 30
      property bool current: false
      signal resetOtherAccordions()
      function resetHeight(){
          root.children[0].children[1].visible = false
          root.children[0].children[1].height = 0
          root.current = false
      }
          Rectangle {
              id: bar
              anchors.top:root.top
              anchors.left:root.left
              anchors.right:root.right
              height: 30
              color:  root.current ? "#81BEF7" : "#CEECF5"
              Text {
                  anchors.fill: parent
                  anchors.margins: 10
                  horizontalAlignment: Text.AlignLeft
                  verticalAlignment: Text.AlignVCenter
                  text: root.title
              }
              Text {
                  anchors{
                      right: parent.right
                      top: parent.top
                      bottom: parent.bottom
                      margins: 10
                  }
                  horizontalAlignment: Text.AlignRight
                  verticalAlignment: Text.AlignVCenter
                  text: "^"
                  rotation: root.current ? "180" : 0
              }
              MouseArea {
                  anchors.fill: bar
                  cursorShape: Qt.PointingHandCursor
                  onClicked: {
                      root.current = !root.current; //toggle ao current
                      resetOtherAccordions()
                      if(root.current) {
                          root.children[1].visible = true
                          root.children[1].height = root.children[1].children[0].children[0].height
                          console.log("childrenRect height of: "+root.children[1].children[0].children[0].height)//gives 0
                          console.log("height of: "+root.children[1].children[0].children[0].childrenRect.height)//gives 0
                          console.log("title of: "+root.children[1].children[0].children[0].title)//gives teste
                          root.height = 30+root.children[1].height
                      }
                      else {
                          root.children[1].visible = false
                          root.children[1].height = 0
                          root.height = 30
                      }
                  }
              }
          }
          Rectangle {
              id: container
              anchors.top:bar.bottom
              anchors.left:root.left
              anchors.right:root.right
              color:"white"
              height:0
              visible:false
              Loader {
                  id: yourLoader
                  anchors.fill:container
                  anchors.top:container.top
                  sourceComponent: root.content
              }
              Behavior on height {
                  PropertyAnimation { duration: 100 }
              }
          }
  }
  </code></pre>
  
  <p>What am i missing? thanks</p>