diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2016-07-08 11:49:32 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2016-07-11 09:32:45 +0000 |
commit | ecbdc9eb621e0042f6778f4a9a5cac87d95f6d1b (patch) | |
tree | 089fecbfb99859bd1ed10b4864e300fc359ba109 /src/ivicore/qivisearchandbrowsemodel.h | |
parent | d03dfaa1e05693b9a55166551657430314eef70a (diff) | |
download | qtivi-ecbdc9eb621e0042f6778f4a9a5cac87d95f6d1b.tar.gz |
Added an async indexOf function to the SearchAndBrowseModel
It takes a JS functor as the second argument, which will be
executed once the result is returned from the backend.
Started to use this method in the tuner example and backend
Change-Id: I11794e1dbc8f182f1ba06e10423fc937ceae8909
Reviewed-by: Johan Thelin <johan.thelin@pelagicore.com>
Diffstat (limited to 'src/ivicore/qivisearchandbrowsemodel.h')
-rw-r--r-- | src/ivicore/qivisearchandbrowsemodel.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ivicore/qivisearchandbrowsemodel.h b/src/ivicore/qivisearchandbrowsemodel.h index dd7bb64..41a2069 100644 --- a/src/ivicore/qivisearchandbrowsemodel.h +++ b/src/ivicore/qivisearchandbrowsemodel.h @@ -44,6 +44,7 @@ #include <QtIviCore/QIviAbstractFeatureListModel> #include <QtIviCore/QIviServiceObject> +#include <QtQml/QJSValue> QT_BEGIN_NAMESPACE @@ -145,6 +146,8 @@ public: Q_INVOKABLE void insert(int index, const QVariant &variant); Q_INVOKABLE void remove(int index); Q_INVOKABLE void move(int cur_index, int new_index); + //TODO add a C++ version for this, similar to QTimer::singleShot() + Q_INVOKABLE void indexOf(const QVariant &variant, const QJSValue &functor); template <typename T> T at(int i) const { return data(index(i,0), ItemRole).value<T>(); @@ -176,6 +179,7 @@ private: Q_PRIVATE_SLOT(d_func(), void onDataFetched(const QUuid &identifer, const QList<QVariant> &items, int start, bool moreAvailable)) Q_PRIVATE_SLOT(d_func(), void onCountChanged(const QUuid &identifier, int new_length)) Q_PRIVATE_SLOT(d_func(), void onDataChanged(const QUuid &identifier, const QList<QVariant> &data, int start, int count)) + Q_PRIVATE_SLOT(d_func(), void onIndexOfCallResult(const QUuid &identifier, int callID, int index)) Q_PRIVATE_SLOT(d_func(), void onFetchMoreThresholdReached()) }; |