QIviSearchAndBrowseModelInterface Class
The QIviSearchAndBrowseModelInterface defines the interface for backends to the QIviSearchAndBrowseModel feature class. More...
Header: | #include <QIviSearchAndBrowseModelInterface> |
qmake: | QT += ivicore |
Inherits: | QIviPagingModelInterface |
Public Functions
virtual QIviPendingReply<QString> | goBack(const QUuid &identifier) = 0 |
virtual QIviPendingReply<QString> | goForward(const QUuid &identifier, int index) = 0 |
virtual QIviPendingReply<int> | indexOf(const QUuid &identifier, const QVariant &item) = 0 |
virtual QIviPendingReply<void> | insert(const QUuid &identifier, int index, const QVariant &item) = 0 |
virtual QIviPendingReply<void> | move(const QUuid &identifier, int currentIndex, int newIndex) = 0 |
virtual QIviPendingReply<void> | remove(const QUuid &identifier, int index) = 0 |
virtual void | setContentType(const QUuid &identifier, const QString &contentType) = 0 |
virtual void | setupFilter(const QUuid &identifier, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms) = 0 |
Signals
void | availableContentTypesChanged(const QStringList &availableContentTypes) |
void | canGoBackChanged(const QUuid &identifier, bool canGoBack) |
void | canGoForwardChanged(const QUuid &identifier, const QVector<bool> &indexes, int start) |
void | contentTypeChanged(const QUuid &identifier, const QString &contentType) |
void | queryIdentifiersChanged(const QUuid &identifier, const QSet<QString> &queryIdentifiers) |
Protected Functions
QSet<QString> | identifiersFromItem() |
Detailed Description
The QIviSearchAndBrowseModelInterface is the interface used by QIviSearchAndBrowseModel
The interface is discovered by a QIviSearchAndBrowseModel object, which connects to it and sets it up.
Every QIviSearchAndBrowseModel generates its own QUuid which is passed to the backend interface and can be used to identify a model instance.
//TODO explain how the interface works on a example <example of a fully featured backend>
See also QIviSearchAndBrowseModel.
Member Function Documentation
[signal]
void QIviSearchAndBrowseModelInterface::availableContentTypesChanged(const QStringList &availableContentTypes)
Emitted during the initialization phase, to inform about all available content types(availableContentTypes).
The value is provided to the user as indication of which content types can be used.
Note: The QIviSearchAndBrowseModel doesn't check the validity of the contentType, this is the responsibility of the backend.
See also setContentType.
[signal]
void QIviSearchAndBrowseModelInterface::canGoBackChanged(const QUuid &identifier, bool canGoBack)
Emitted to inform the QIviSearchAndBrowseModel instance, identified by identifier, whether it canGoBack to the data set previously shown. If the instance can display the previous data set, canGoBack is set to true
.
See Browsing for more information on how this is used.
See also goBack.
[signal]
void QIviSearchAndBrowseModelInterface::canGoForwardChanged(const QUuid &identifier, const QVector<bool> &indexes, int start)
Emitted to inform the QIviSearchAndBrowseModel instance identified by identifier that the following indexes can be used to show a new set of data.
The start parameter can be used to inform only about a limited set of indexes. This signal can be emitted during a QIviPagingModelInterface::fetchData() call to inform about the state of the just fetched data.
See Browsing for more information on how this is used.
See also goForward.
[signal]
void QIviSearchAndBrowseModelInterface::contentTypeChanged(const QUuid &identifier, const QString &contentType)
Emitted as a result of a call to setContentType, to inform the QIviSearchAndBrowseModel instance identified by identifier about it's new contentType.
See also setContentType.
[signal]
void QIviSearchAndBrowseModelInterface::queryIdentifiersChanged(const QUuid &identifier, const QSet<QString> &queryIdentifiers)
Emitted as a result of a call to setContentType, to inform the QIviSearchAndBrowseModel instance identified by identifier about the currently supported queryIdentifiers.
The queryIdentifiers are used to setup the Qt IVI Query Language to be able to show meaningful errors for invalid queries. Not emitting this signal, will cause the Qt IVI Query Language to not limit the possible identifiers.
[pure virtual]
QIviPendingReply<QString> QIviSearchAndBrowseModelInterface::goBack(const QUuid &identifier)
Requests to go back to the previous displayed data set of the QIviSearchAndBrowseModel instance identified by identifier.
The new content type is returned in the form of a QIviPendingReply. Once ready the new content type must be set using setSuccess(), or using setFailed() if there's an error.
See Browsing for more information on how this is used.
See also canGoBackChanged().
[pure virtual]
QIviPendingReply<QString> QIviSearchAndBrowseModelInterface::goForward(const QUuid &identifier, int index)
Requests to go to the next data set of the QIviSearchAndBrowseModel instance identified by identifier at index.
The new content type is returned in the form of a QIviPendingReply. Once ready the new content type must be set using setSuccess(), or using setFailed() if there's an error.
See Browsing for more information on how this is used.
See also canGoForwardChanged().
[protected]
template <typename T> QSet<QString> QIviSearchAndBrowseModelInterface::identifiersFromItem()
Returns all properties of type T.
These can registered as identifiers for the Qt IVI Query Language using the queryIdentifiersChanged() signal.
[pure virtual]
QIviPendingReply<int> QIviSearchAndBrowseModelInterface::indexOf(const QUuid &identifier, const QVariant &item)
Determines the index of item in the model identified by identifier.
[pure virtual]
QIviPendingReply<void> QIviSearchAndBrowseModelInterface::insert(const QUuid &identifier, int index, const QVariant &item)
Adds the browsable item to the current dataset of the QIviSearchAndBrowseModel instance identified by identifier at index.
The provided item could be owned by another model or QML, because of that it's expected that the backend stores its internal representation.
See also dataChanged().
[pure virtual]
QIviPendingReply<void> QIviSearchAndBrowseModelInterface::move(const QUuid &identifier, int currentIndex, int newIndex)
Moves the browsable item at position currentIndex of the current dataset of the QIviSearchAndBrowseModel instance identified by identifier to the new position newIndex.
See also dataChanged().
[pure virtual]
QIviPendingReply<void> QIviSearchAndBrowseModelInterface::remove(const QUuid &identifier, int index)
Removes the browsable item at position index from the current dataset of the QIviSearchAndBrowseModel instance identified by identifier.
See also dataChanged().
[pure virtual]
void QIviSearchAndBrowseModelInterface::setContentType(const QUuid &identifier, const QString &contentType)
Sets the contentType of the QIviSearchAndBrowseModel instance identified by identifier. The given contenType can contain additional path information. The encoding is defined by the goForward() method. In case the contentType is not valid the error() signal should be used.
Note: The QIviSearchAndBrowseModel doesn't check the validity of the contentType, this is the backend's responsibility.
If the QIviSearchAndBrowseModel supports filtering (see QIviPagingModel::capabilitiesChanged), the backend needs to emit the queryIdentifiersChanged signal once the contentType is set.
Finally, the contentTypeChanged signal needs to be emitted, when the backend has set the contentType and it's ready for use.
Calls to this function are followed by calls to setupFilter() and fetchData().
See also identifiersFromItem, queryIdentifiersChanged, and contentTypeChanged.
[pure virtual]
void QIviSearchAndBrowseModelInterface::setupFilter(const QUuid &identifier, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms)
Setup the filter for the QIviSearchAndBrowseModel instance identified by identifier.
The term and orderTerms arguments are representations of the query which is used for filtering and sorting. The term argument is a null-pointer when the backend doesn't support filtering and sorting or when no query was defined in the QIviSearchAndBrowseModel instance.
© 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.