Hi Guyz
I am struck with this simple logic in assigning selected child checkbox values to header checkbox values.This requiremnet is as simple as we see in our daily life i.e., When i select/unselect Header Checkbox all child checkboxes has to be selected/unselected. I could do the above requiremnet. Going further ,when i deselect any of the child checkbox ,header checkbox has to be deselected.I could not achieve the same.Can you guys help me in achieving this as i am struggling for few days. Here i add my source code which i am able to select/deselect child checkbox wen i change header checkbox accordingly.



Qt Code:
  1. Rectangle{
  2. id: header
  3. width: 620
  4. height: 70
  5. y: 150
  6. color: "#E8E8E8"
  7. anchors{left: parent.left;leftMargin: 110;top:separator.bottom}
  8.  
  9. CheckBox {
  10. id: headerCombo
  11. text: qsTr("Select All")
  12. checked: false
  13. anchors{left: parent.left;leftMargin: 38;top:parent.top;topMargin: 20}
  14.  
  15. onCheckedChanged: {
  16. for(var i=0;i<checkBoxModel.count;i++)
  17. {
  18. checkBoxModel.set(i,{"selected": headerCombo.checked})
  19. }
  20. }
  21. }
  22. }
  23.  
  24. ListModel {
  25. id: checkBoxModel
  26. ListElement { selected: false; }
  27. ListElement { selected: false; }
  28. ListElement { selected: false; }
  29. ListElement { selected: false; }
  30. ListElement { selected: false; }
  31. ListElement { selected: false; }
  32. }
  33.  
  34.  
  35. ListView{
  36. id: listt
  37. model: checkBoxModel
  38. clip:true
  39. width: 620
  40. anchors{left: parent.left;leftMargin: 110;top: header.bottom;topMargin: 10;bottom: bottomBar.top}
  41. delegate: listDelegate
  42. }
  43.  
  44. Component {
  45. id: listDelegate
  46. Item {
  47. id: name
  48. width: 620
  49. height: 70
  50.  
  51. CheckBox {
  52. id: childCombo
  53. text: qsTr("Select All")
  54. checked: selected
  55. anchors{left: parent.left;leftMargin: 38;top:parent.top;topMargin: 20}
  56. }
  57. }
  58. }
To copy to clipboard, switch view to plain text mode 



Regards
Bala Beemaneni