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

QIviSearchAndBrowseModelInterface(QObject *parent = nullptr)
virtual QSet<QString> availableContentTypes() const
virtual bool canGoBack(const QUuid &identifier, const QString &type) = 0
virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) = 0
virtual QString goBack(const QUuid &identifier, const QString &type) = 0
virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) = 0
virtual QIviPendingReply<int> indexOf(const QUuid &identifier, const QString &type, const QIviStandardItem *item) = 0
virtual QIviPendingReply<void> insert(const QUuid &identifier, const QString &type, int index, const QIviStandardItem *item) = 0
virtual QIviPendingReply<void> move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) = 0
virtual QIviPendingReply<void> remove(const QUuid &identifier, const QString &type, 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
virtual QSet<QString> supportedIdentifiers(const QString &contentType) const

Protected Functions

void registerContentType(const QString &contentType)

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

QIviSearchAndBrowseModelInterface::QIviSearchAndBrowseModelInterface(QObject *parent = nullptr)

Constructs a backend interface.

The parent is sent to the QObject constructor.

[virtual] QSet<QString> QIviSearchAndBrowseModelInterface::availableContentTypes() const

Returns all the available content types for this backend instance.

It's recommended to use the registerContentType() function instead, which takes care of this function for you.

[pure virtual] bool QIviSearchAndBrowseModelInterface::canGoBack(const QUuid &identifier, const QString &type)

Returns true when the QIviSearchAndBrowseModel instance identified by identifier can go back and return to the previously shown data set. The type parameter holds the currently displayed content type.

See Browsing for more information on how this is used.

See also goBack().

[pure virtual] bool QIviSearchAndBrowseModelInterface::canGoForward(const QUuid &identifier, const QString &type, const QString &itemId)

Returns true when the QIviSearchAndBrowseModel instance identified by identifier and the current content type type has an item identified by itemId and this item can be used to show a new set of data.

See Browsing for more information on how this is used.

See also goForward.

[pure virtual] QString QIviSearchAndBrowseModelInterface::goBack(const QUuid &identifier, const QString &type)

Requests to go back to the previous displayed data set of the QIviSearchAndBrowseModel instance identified by identifier. The current content type is passed as type and the new content type should be returned.

See Browsing for more information on how this is used.

See also canGoBack().

[pure virtual] QString QIviSearchAndBrowseModelInterface::goForward(const QUuid &identifier, const QString &type, const QString &itemId)

Requests to go to the next data set of the QIviSearchAndBrowseModel instance identified by identifier and the current content type type. The item which is used for the new set of data is passed as itemId and the new content type should be returned.

See Browsing for more information on how this is used.

See also canGoForward().

[pure virtual] QIviPendingReply<int> QIviSearchAndBrowseModelInterface::indexOf(const QUuid &identifier, const QString &type, const QIviStandardItem *item)

Determines the index of item in the model identified by identifier and type.

[pure virtual] QIviPendingReply<void> QIviSearchAndBrowseModelInterface::insert(const QUuid &identifier, const QString &type, int index, const QIviStandardItem *item)

Adds the browsable item into the current dataset of the QIviSearchAndBrowseModel instance identified by identifier and the current content type type 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, const QString &type, int currentIndex, int newIndex)

Moves the browsable item at position currentIndex of the current dataset of the QIviSearchAndBrowseModel instance identified by identifier and the current content type type to the new position newIndex.

See also dataChanged().

[protected] template <typename T> void QIviSearchAndBrowseModelInterface::registerContentType(const QString &contentType)

Registers the type T with the name contentType. In addition all properties of type T will be registered as identifiers for the Qt IVI Query Language

[pure virtual] QIviPendingReply<void> QIviSearchAndBrowseModelInterface::remove(const QUuid &identifier, const QString &type, int index)

Removes the browsable item at position index from the current dataset of the QIviSearchAndBrowseModel instance identified by identifier and the current content type type.

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 by the goForward() method.

Calls to this function are followed by calls to setupFilter() and fetchData()

[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.

[virtual] QSet<QString> QIviSearchAndBrowseModelInterface::supportedIdentifiers(const QString &contentType) const

Returns the available identifiers for the given contentType.

Every identifier can be used in the Qt IVI Query Language for filtering or sorting.

It's recommended to use the registerContentType() function instead, which takes care of this function for you.

© 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.