PagingModel QML Type
The PagingModel is a generic model to load its data using the "Paging" aproach. More...
|import QtIvi 1.0
- capabilities : enumeration
- chunkSize : int
- count : int
- fetchMoreThreshold : int
- loadingType : enumeration
The PagingModel should be used directly or as a base class whenever a lot of data needs to be presented in a ListView.
The model only fetches the data it really needs and can it can be configured how this can be done using the loadingType property.
All rows in the model need to be subclassed from StandardItem.
The following roles are available in this model:
|The name of the item. E.g. The name of a contact in a addressbook, or the artist-name in a list of artists.
|The type of the item. E.g. "artist", "track", "contact".
|The item itself. This provides access to the properties which are type specific. E.g. the address of a contact.
The PagingModel is using QtIviCore's Dynamic Backend System and is derived from QIviAbstractFeatureListModel. Other than most "QtIvi Feature classes", the PagingModel doesn't automatically connect to available backends.
The easiest approach to set it up, is to connect to the same backend used by another feature. E.g. for connecting to the media backend, use the instance from the mediaplayer feature:
Multiple loading types are supported, as the PagingModel is made to work with asynchronous requests to fetch its data. The FetchMore loading type is the default and is using the canFetchMore()/fetchMore() functions of QAbstractItemModel to fetch new data once the view hits the end of the currently available data. As fetching can take some time, there is the fetchMoreThreshold property which controls how much in advance a new fetch should be started.
The other loading type is DataChanged. In contrast to FetchMore, the complete model is pre-populated with empty rows and the actual data for a specific row is fetched the first time the data() function is called. Once the data is available, the dataChanged() signal will be triggered for this row and the view will start to render the new data.
Please see the documentation of loadingType for more details on how the modes work and when they are suitable to use.
capabilities : enumeration
Holds the capabilities of the backend.
The capabilities controls what the backend supports. It can be a combination of the following values:
|The backend does only support the minimum feature set and is stateful.
|The backend can return the final number of items for a specific request. This makes it possible to support the QIviPagingModel::DataChanged loading type.
|The backend supports filtering of the content. QIviSearchAndBrowseModelInterface::availableContentTypesChanged() and QIviSearchAndBrowseModelInterface::queryIdentifiersChanged() will be used as input for the Qt IVI Query Language.
|The backend supports sorting of the content. QIviSearchAndBrowseModelInterface::availableContentTypesChanged() and QIviSearchAndBrowseModelInterface::queryIdentifiersChanged() will be used as input for the Qt IVI Query Language.
|The backend supports handling multiple filters at the same time and these filters can be combined by using the AND conjunction.
|The backend supports handling multiple filters at the same time and these filters can be combined by using the OR conjunction.
|The backend is stateless and supports handling multiple instances of a QIviSearchAndBrowseModel requesting different data at the same time. E.g. One request for artists, sorted by name and another request for tracks. The backend has to consider that both request come from models which are currently visible at the same time.
|The backend supports inserting new items at a given position.
|The backend supports moving items within the model.
|The backend supports removing items from the model.
chunkSize : int
Holds the number of rows which are requested from the backend interface.
This property can be used to fine tune the loading performance.
Bigger chunks means less calls to the backend and to a potential IPC underneath, but more data to be transferred and probably longer waiting time until the request was finished.
count : int
Holds the current number of rows in this model.
fetchMoreThreshold : int
Holds the row delta to the end before the next chunk is loaded
This property can be used to fine tune the loading performance. When the threshold is reached the next chunk of rows are requested from the backend. How many rows are fetched can be defined by using the chunkSize property.
The threshold defines the number of rows before the cached rows ends.
loadingType : enumeration
Holds the currently used loading type used for loading the data.
|This is the default and can be used if you don't know the final size of the list (e.g. a infinite list). The list will detect that it is near the end (fetchMoreThreshold) and then fetch the next chunk of data using canFetchMore and fetchMore. The drawback of this method is that you can't display a dynamic scroll-bar indicator which is resized depending on the content of the list, because the final size of the data is not known. The other problem could be fast scrolling, as the data might not arrive in-time and scrolling stops. This can be tweaked by the fetchMoreThreshold property.
|For this loading type you need to know how many items are in the list, as dummy items are created and the user can already start scrolling even though the data is not yet ready to be displayed. Similar to FetchMore, the data is also loaded in chunks. You can safely use a scroll indicator here. The delegate needs to support this approach, as it doesn't have content when it's first created.
Note: When changing this property the content will be reset.
This signal is emitted whenever the fetchMoreThreshold is reached and new data is requested from the backend.
Note: The corresponding handler is
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.