I am using QtQuick.Controls 2, so TableViewColumn which belongs to older QtQuick cannot be used here.

https://www.qt.io/blog/2016/10/06/qt...2-1-and-beyond
Some notable missing features from Qt Quick Controls 1 are Action, SplitView, TableView, and TreeView.
If it is not supported at all, then what is the way to form a table in QML?

How to insert Columns in this table with style delegates?

Qt Code:
  1. import QtQuick.Window 2.12
  2. import QtQuick 2.12
  3. import QtQuick.Controls 2.12
  4. import QtQuick.Controls.Styles 1.4
  5.  
  6. Window
  7. {
  8. visible: true
  9. width: 640
  10. height: 480
  11. title: qsTr("Hello World")
  12.  
  13. TableView
  14. {
  15. height: 200; width: 200
  16. columnSpacing: 1
  17. rowSpacing: 1
  18.  
  19. x: 10; y: 10
  20.  
  21. model: ListModel
  22. {
  23. id: mymodel
  24. ListElement
  25. {
  26. aaa : "Banana1"
  27. bbb : "Apple1"
  28. }
  29. ListElement
  30. {
  31. aaa : "Banana2"
  32. bbb : "Apple2"
  33. }
  34. }
  35.  
  36.  
  37. delegate: Rectangle
  38. {
  39. implicitWidth: 100
  40. implicitHeight: 50
  41. color: "red"
  42. border.color: "black"
  43. Text
  44. {
  45. text: mymodel.data(1,"aaa")
  46. }
  47. }
  48.  
  49. MouseArea
  50. {
  51. anchors.fill: parent
  52. onClicked:
  53. {
  54. console.log( mymodel.display)
  55. }
  56. }
  57. }
To copy to clipboard, switch view to plain text mode