Tools for making improved models with Qt

December 1, 2019

Qt QAbstractItemModel API is used for both widgets and QML applications where it plays a central role for cases where there is a need to present larger quantities of data. For optimal performance, UI experience and to be able to use the insert, remove, move and displaced transitions on the QML ListView it is imperative that updates are signaled properly and as finely-grained as possible. But how do we deal with back-ends that don’t deliver enough data to do this? What if they just signal ‘changed’ or give us a whole new list without indicating what changed? Instead of relying on repetitive, hard-to-read and error-prone code or in the worst case relying on a model reset, I will present a generic approach leading to a simple drop-in solution to deal with data that comes in in bulk which results in proper, finely-grained updates to the model. A similar problem is providing all needed signals in case the model needs to be sorted. While a QSortFilterProxyModel does a good job doing the actual sorting, it does not provide the required signals to allow animating items moving in a QML ListView when the value of items changes or when the sort role or -column changes. In order to fix this, I will present a specialized proxy model that does enable this. Using these tools will help you make your models behave like “model” models.

TALK: Model Models - Tools for Making Better Behaved Models

SPEAKER: André Somers

COMPANY: KDAB

TRACK: Tooling & Testing

Talk recorded at the Qt World Summit 2019 event in Berlin. #QtWS19 November 2019 - BCC 

Previous Video
Using CMake and vcpkg in Qt application development
Using CMake and vcpkg in Qt application development

Building a Qt Application with Modern CMake and vcpkg -- Alexandru Croitor --The Qt Company

Next Video
Practical application scripting with QML
Practical application scripting with QML

Practical Application Scripting With QML -- Kevin Krammer -- KDAB