summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2020-02-12 12:02:00 +0100
committerDominik Holland <dominik.holland@qt.io>2020-02-19 16:54:16 +0100
commit9cfe33d13bb145b774f82b2b46b936f7b3a02a71 (patch)
treea96c5db21fda5a040cfbfb885d3d461e691b5801
parentf2be418701f451a4d68a4949d996b873b1836305 (diff)
downloadqtivi-9cfe33d13bb145b774f82b2b46b936f7b3a02a71.tar.gz
QIviPagingModel: Don't emit a warning when the emitted data is out of range
To notify the QIviPagingModel instance about data changes, e.g. new rows, the dataChanged() signal is used. The QIviPagingModel will check the provided data and report a warning if the data is out of range. While this is correct for using the "DataChanged" fetch mode, where the amount of items is in sync with the backend, it doesn't make sense for the "FetchMore" mode, as the QIviPagingModel instance might not fetched all rows (just the visible ones) and the update is for an area outside of interest. Task-number: AUTOSUITE-1464 Change-Id: I606e141268c7a609e98ffa3081d414a46e1c3d93 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r--src/ivicore/qivipagingmodel.cpp6
-rw-r--r--src/ivimedia/qiviplayqueue.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/ivicore/qivipagingmodel.cpp b/src/ivicore/qivipagingmodel.cpp
index 0ddf289..b9bd4df 100644
--- a/src/ivicore/qivipagingmodel.cpp
+++ b/src/ivicore/qivipagingmodel.cpp
@@ -169,12 +169,14 @@ void QIviPagingModelPrivate::onDataChanged(const QUuid &identifier, const QList<
return;
if (start < 0 || start > m_itemList.count()) {
- qWarning("provided start argument is out of range");
+ if (m_loadingType == QIviPagingModel::DataChanged)
+ qWarning("The provided start argument is out of range. Please make sure to emit the countChanged() before emitting dataChanged()");
return;
}
if (count < 0 || count > m_itemList.count() - start) {
- qWarning("provided count argument is out of range");
+ if (m_loadingType == QIviPagingModel::DataChanged)
+ qWarning("The provided start argument is out of range. Please make sure to emit the countChanged() before emitting dataChanged()");
return;
}
diff --git a/src/ivimedia/qiviplayqueue.cpp b/src/ivimedia/qiviplayqueue.cpp
index 4d30461..895f6dc 100644
--- a/src/ivimedia/qiviplayqueue.cpp
+++ b/src/ivimedia/qiviplayqueue.cpp
@@ -150,12 +150,14 @@ void QIviPlayQueuePrivate::onCountChanged(int new_length)
void QIviPlayQueuePrivate::onDataChanged(const QList<QVariant> &data, int start, int count)
{
if (start < 0 || start > m_itemList.count()) {
- qWarning("provided start argument is out of range");
+ if (m_loadingType == QIviPlayQueue::DataChanged)
+ qWarning("The provided start argument is out of range. Please make sure to emit the countChanged() before emitting dataChanged()");
return;
}
if (count < 0 || count > m_itemList.count() - start) {
- qWarning("provided count argument is out of range");
+ if (m_loadingType == QIviPlayQueue::DataChanged)
+ qWarning("The provided start argument is out of range. Please make sure to emit the countChanged() before emitting dataChanged()");
return;
}