From c0441dcd9722b0e40c26501241d76423fd71b459 Mon Sep 17 00:00:00 2001 From: Peinthor Rene Date: Tue, 16 Apr 2013 19:57:03 +0200 Subject: [PATCH] Revert "don't canFetchMore on our own" This reverts commit b9af3706e78adad1b3d86cde32266b643aa59a54. As explained MKleusberg, this might be needed, and this practise is also used by Qt itself. --- src/sqlitetablemodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index 6c08f8aa..b1d68b9d 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -130,6 +130,10 @@ QVariant SqliteTableModel::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { + // If this row is not in the cache yet get it first + while(index.row() >= m_data.size() && canFetchMore()) + const_cast(this)->fetchMore(); // Nothing evil to see here, move along + return m_data.at(index.row()).at(index.column()); } else { return QVariant();