Hii,
Quote Originally Posted by anda_skoa View Post
you could store the current main menu delegete index in the sub item delegetes as part of the initialization in the loader
_
How can I do it, Could you give me an example ??

Qt Code:
  1. Component {
  2. // main menu delegete
  3. id: categoryDelegate
  4. Column {
  5. Rectangle {
  6. ...
  7. MouseArea {
  8.  
  9. onClicked: {
  10. console.log(menuModel.get(index))
  11. }
  12. }
  13. }
  14. Loader {
  15. id: subItemLoader
  16.  
  17. // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null
  18. // the Loader element retains the same height it had when sourceComponent was set. Setting visible
  19. // to false makes the parent Column treat it as if it's height was 0.
  20. visible: !collapsed
  21. property variant subItemModel : subItems
  22. sourceComponent: collapsed ? null : subItemColumnDelegate
  23. onStatusChanged: if (status == Loader.Ready) item.model = subItemModel
  24. }
  25. }
  26. }
  27. Component {
  28. // sub menu delegete
  29. id: subItemColumnDelegate
  30. Column {
  31. property alias model : subItemRepeater.model
  32. Repeater {
  33. id: subItemRepeater
  34. delegate: Rectangle {
  35. ...
  36. MouseArea {
  37. onClicked:{
  38. if(menuModel.get(index)){
  39. switch(index) {
  40. case 0:
  41. stack.push(view1)
  42. break;
  43. case 1:
  44. stack.push(view2)
  45. break;
  46. }
  47. }
  48. }
  49. }
  50. }
To copy to clipboard, switch view to plain text mode 

Cheers,