As you start to build more complex applications with PyQt you'll likely come across issues keeping widgets in sync with your data.
Data stored in widgets (e.g. a simple
QListWidget) is not easy to manipulate from Python — changes require you to get an item, get the data, and then set it back. The default solution to this is to keep an external data representation in Python, and then either duplicate updates to the both the data and the widget, or simply rewrite the whole widget from the data. As you start to work with larger data this approach can start to have performance impacts on your application.
Thankfully Qt has a solution for this — ModelViews. ModelViews are a powerful alternative to the standard display widgets, which use a standardized model interface to interact with data sources — from simple data structures to external databases. This isolates your data, meaning you can keep it in any structure you like, while the view takes care of presentation and updates.
In this next part of the PyQt5 course we'll discover how you can use Qt ModelViews to build high performance Python GUIs.