title: Trying to call custom function from ListElement in ListModel QML
body: <p>I have, for example, such model in my QML:</p>
  
  <pre><code>ListModel{
      id: mainlist
      ListElement
      {
          name: "Name1"
          type: "subMenu"
          toogle: false
          iconSource: ""
  
          function actionClick()
          {
              console.log("actionclick is passed for 0 item!")
          }
      }
      ListElement
      {
          name: "Manage Favorites"
          type: "subMenu"
          toogle: false
          iconSource: "image://provider/common/endless_menu/list_icons/fav"
  
          function actionClick()
          {
              console.log("actionclick is passed for 1 item!")
          }
      }
      ListElement
      {
          name: "Name2"
          type: "subMenu"
          toogle: false
          iconSource: "image://provider/common/endless_menu/list_icons/active"
  
          function actionClick()
          {
              console.log("actionclick is passed for 2 item!")
          }
      }
      ListElement
      {
          name: "Name3"
          type: "subMenu"
          toogle: false
          iconSource: "image://provider/common/endless_menu/list_icons/scan"
  
          function actionClick()
          {
              console.log("actionclick is passed for 3 item!")
          }
      }
      ListElement
      {
          name: "Manual Frequency Input"
          type: "commonBtn"
          toogle: false
          iconSource: ""
  
          function actionClick()
          {
              console.log("actionclick is passed for 4 item!")
          }
      }
  
      function onStart(currIndex)
      {
          console.log("test is passed for " + currIndex + "item!")
      }
  }
  </code></pre>
  
  <p>So, I have ListView element with <code>id: optionlist</code>, and ListDelegate for control list elements. 
  I have several model - all this elements created for menu options in project.
  So, code <code>onModelChanged: optionlist.model.onStart()</code> in list file work perfectly.</p>
  
  <p>Problem is to call <code>actionClick()</code> function from listDelegate script <code>OnClicked</code> in MouseArea element. Is it possible to do this? 
  Something like this: <code>optionlist.model.ContentItem.children[currentIndex].actionClick()</code> maybe or something else?</p>
  
  <p>UPDATE:
  Sorry, Amit Tomer, maybe I don't explain task correctly... So, I need element in model with next fields:</p>
  
  <pre><code>name: - text for element
  type: - type of element (button, radio button, check button or submenu) - needed for corect action when user clicked on this item
  toogle: - boolean value for radio/check buttons state, and for some internal operations.
  iconSource: - path for icon, if it needed.
  
  function actionClick() - function, which will be execute when user clicked on this item.
  </code></pre>
  
  <p>All this must be done for clearly and easily filled up All option menu tree. This menu tree will be write in separate file. </p>
  
  <p>In code below I show worked model:</p>
  
  <pre><code>Item{
      id: menuoptions
  
      property ListModel prev: manageFavorites
      property bool root: true
  
  //Main Menu
      property alias mainlist: mainlist
      ListModel{
          id: mainlist
          ListElement
          {
              name: "Band: "
              type: "subMenu"
              toggle: false
              iconSource: ""
          }
          ListElement
          {
              name: "Manage Favorites"
              type: "subMenu"
              toggle: false
              iconSource: "image://provider/common/endless_menu/list_icons/fav"
          }
          ListElement
          {
              name: "Show: "
              type: "subMenu"
              toggle: false
              iconSource: "image://provider/common/endless_menu/list_icons/active"
          }
          ListElement
          {
              name: "Scan"
              type: "subMenu"
              toggle: false
              iconSource: "image://provider/common/endless_menu/list_icons/scan"
          }
          ListElement
          {
              name: "Manual Frequency Input"
              type: "commonBtn"
              toggle: false
              iconSource: ""
          }
  
          function actionClick(currIndex)
          {
              switch(currIndex)
              {
                  case 0:
                  {
                      prev = mainlist
                      menuList.model = bandlist
                      break
                  }
              case 1:
                  {
                      prev = mainlist
                      menuList.model = manageFavorites
                      break
                  }
              case 2:
                  {
                      prev = mainlist
                      menuList.model = showlist
                      break
                  }
              case 3:
                  {
                      console.log("Scan started")
                      mainlist.setProperty(3, "name", getScan())
                      break
                  }
              case 4:
                  {
                      console.log("Speller for Manual Frequency Input open!")
                      break
                  }
              }
          }
  
          function onStart()
          {
              console.log("root model loaded")
              root = true
              mainlist.setProperty(0, "name", "Band: " + getBand())
              mainlist.setProperty(2, "name", "Show: " + getShow())
              mainlist.setProperty(3, "name", getScan())
          }
      }
  
  //First Lvl subMenu
      property alias bandlist: bandlist
      ListModel{
          id: bandlist
          ... Analog menulist
      }
  
      property alias manageFavorites: manageFavorites
      ListModel{
          id: manageFavorites
          ... Analog menulist
      }
  
      property alias showlist: showlist
      ListModel{
          id: showlist
          ... Analog menulist
      }
  }
  </code></pre>
  
  <p>As you see, I wrote something like You say. It's okay, If I don't find better solution. Beter solution - remove actionClick() general function and added it's part (code in case blocks) to ListElement respectively. And call it when Element's click. </p>
  
  <p>I don't know how call this function from ListElement. In WPF I would just create custom component, which replease ListElement and just all! But I don't know how do this in QML.</p>
  
  <p>I anything not clear - please ask.</p>
  
  <p>UPDATE: Problem solved. My variant in answers. Thanks to all.</p>