Hi,

I want to bind QStandardItemModel to a table(TableView or GridView or ...) with several rows and columns.

Table must have not any scroll and height of table is equal of count of row.

I can show QStandardItemModel in tableview but height of it more than from count of row.

I can show QStandardItemModel in GridView but it can show just one record.

Please gide me.

Qt Code:
  1. TableView {
  2. id: tablemodel
  3. anchors.fill: parent
  4.  
  5. model: myXML.newMyModel
  6.  
  7.  
  8. MyTableViewColumn {
  9. role: "field1"
  10. }
  11. MyTableViewColumn {
  12. role: "field2
  13. }
  14. MyTableViewColumn {
  15. role: "field3
  16. }
  17. MyTableViewColumn {
  18. role: "field4
  19. }
  20. }
  21.  
  22.  
  23.  
  24. GridView {
  25. anchors.fill: parent
  26. model: myXML.newMyModel
  27.  
  28. delegate: Rectangle {
  29. Text {
  30. text: field1
  31. }
  32. Text {
  33. text: field2
  34. }
  35. Text {
  36. text: field3
  37. }
  38. Text {
  39. text: field4
  40. }
  41. Text {
  42. text: field5
  43. }
  44. Text {
  45. text: field6
  46. }
  47. }
  48. }
To copy to clipboard, switch view to plain text mode