How to download or keep json from the file to QTable (Qt) table?
-
Got a file.
trip.json
For example{ "name": "Hawai", "days": 25 }
How can this file download/ store information in/from the table
QTableView
?
-
♪
QTableView
You can set for display.QAbstractItemModel
(or her heir, in your case, fits--QStandardItemModel
So you need to create your model, the heir of one of these classes, to fill it out..json
The file, and display it in the table byvoid QTableView::setModel(QAbstractItemModel * model).
That is, both in the laboratory and usually in Qt, the logic of completing the model will be in a separate class.