The model should provide this information for you. Create a role in the model which will return the correct value for any given cell. On QML side, just access that role and display it directly. No need for any get() method (which, by the way, is called data() https://doc.qt.io/qt-5/qabstractitemmodel.html#data, not get()).
Hi there.
I think you can use TableViewColumn element to create a new column inside a TableView component.
If necessary, you can define your own delegate to set how the data is showed to user.
Read more:
http://doc.qt.io/qt-5/qml-qtquick-controls-tableview.html#details <- TableView Documentation
http://doc.qt.io/qt-5/qtquickcontrols-tableview-main-qml.html <- TableView Example
Thanks again for helping. But it is not really working for me. My model is a XmlListModel and I tried your code with status == ready and onComplete but nothing. When I add a button and connect the function to onClicked your code works nicely...
Unfortunately the length of the table header is not considered. I believe this is a two year old bug.
At the moment I am using
width: title.length*factor
This seems to work okay for now. I am just curious if it will work on other screens as well.