There is a file trip.json , for example
{ "name": "Hawai", "days": 25 } How to load / save information from / to QTableView from this file?
In QTableView you can set QAbstractItemModel to display (or its successor, QStandardItemModel in your case), respectively, you need to create your own model - the heir of one of these classes, fill it from the .json file, and display it in the table using the void QTableView::setModel(QAbstractItemModel * model). method void QTableView::setModel(QAbstractItemModel * model).
That is, as required in the lab room, it is usually done in Qt - the logic of filling-saving the model will be in a separate class.
Source: https://ru.stackoverflow.com/questions/473001/
All Articles