Tableview column names not showing.
-
Hi, So I want to create a table similar to the one in the picture.
After some searching I decided to use tableview. My code is given below.
import QtQuick 2.15 import QtQuick.Controls 2.15 import Qt.labs.qmlmodels 1.0 Item { width: 1126 height: 800 Rectangle { id: rectangle color: "#ffffff" anchors.fill: parent anchors.rightMargin: 0 anchors.bottomMargin: 0 anchors.leftMargin: 0 anchors.topMargin: 0 TableView { anchors.fill: parent columnSpacing: 1 rowSpacing: 1 clip: true model: TableModel { TableModelColumn { display: "customer" } TableModelColumn { display: "address" } TableModelColumn { display: "mobile" } TableModelColumn { display: "email" } TableModelColumn { display: "city" } TableModelColumn { display: "state" } TableModelColumn { display: "country" } rows: [ { "customer": "h", "address": "down", "mobile": "34556", "email": "ty@gmail.com", "city": "new york", "state": "new york", "country": "USA" }, { "customer": "h", "address": "down", "mobile": "34556", "email": "ty@gmail.com", "city": "new york", "state": "new york", "country": "USA" }, { "customer": "h", "address": "down", "mobile": "34556", "email": "ty@gmail.com", "city": "new york", "state": "new york", "country": "USA" } ] } delegate: Rectangle { implicitHeight: 50 implicitWidth: 100 border.width: 1 Text { text: display anchors.centerIn: parent } } } } }
The first problem is that I can't see the column name. Secondly I wanted to ask that i'm using pyside2 as the main business language, and i'm going to be connecting to a database all the data in this table will be filled from the database, so I just wanted to confirm whether tableview is the correct choice in this scenario, or should I use something else.