Complex data in PyQt models

Thanks for this awesome tutorial. I have a question about complex data sets. Is it possible for me to use a .json file as my model’s data in pyqt views? I have a rather complex data structure. Do I need to simplify it to a basic table?

Not at all! You can use any data structure you like in your model — just think of the model acting as an interface between how Qt want’s to see your data, and how you want to represent it. As long as your model returns data in the format Qt expects it will work fine.

I have more tutorials on this coming shortly (e.g. using pandas datatables, querying databases and displaying complex datatypes).

More tutorials on using QTableView and how it interact with a QAbstractTableModel would be very usefull. The documentation for this on the internet and in meny of the books is very basic (to basic). And it is very frustrating to check your code for errors since this subject have meny pitfalls.
Expanding your QTableView with QSortFilterProxyModell would also be a good follow up on this subject.

1 Like