summaryrefslogtreecommitdiffstats
path: root/src/sql/models/qsqlquerymodel_p.h
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2012-08-29 09:34:41 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-30 13:51:22 +0200
commitc194b7f3454f470d24be729ef660c5cfe7a9b841 (patch)
tree467b19df91b6a463ea8064c5e92a0bf07189500b /src/sql/models/qsqlquerymodel_p.h
parent98c663acd955ed7f0afcaffc50e738690fbb94ae (diff)
QSqlQueryModel: fix nested beginResetModel/endResetModel
Follow-up to 83c9ebbd6692cde99ee692e6549c591100f12545. Consider the case where calls to the reset methods on the same object are nested as in the following sequence: 1. beginResetModel() 2. beginResetModel() 3. endResetModel() 4. endResetModel() In such cases, only the outermost calls, i.e., 1) and 4), should emit signals. After 83c9ebbd6692cde99ee692e6549c591100f12545, 1) and 3) emitted the signals, which is wrong. This is corrected by keeping track of the nesting level. Such sequences can come about when a base class calls the begin/end methods between the calls made by the subclass. QSqlTableModel::select() is an example of this. Test included. Change-Id: Ia62b45cb1abaab00a32bb8357de4a958bcff83e5 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/sql/models/qsqlquerymodel_p.h')
-rw-r--r--src/sql/models/qsqlquerymodel_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sql/models/qsqlquerymodel_p.h b/src/sql/models/qsqlquerymodel_p.h
index 3288d311a4..70f72f393f 100644
--- a/src/sql/models/qsqlquerymodel_p.h
+++ b/src/sql/models/qsqlquerymodel_p.h
@@ -67,7 +67,7 @@ class QSqlQueryModelPrivate: public QAbstractItemModelPrivate
{
Q_DECLARE_PUBLIC(QSqlQueryModel)
public:
- QSqlQueryModelPrivate() : atEnd(false), resetting(false) {}
+ QSqlQueryModelPrivate() : atEnd(false), nestedResetLevel(0) {}
~QSqlQueryModelPrivate();
void prefetch(int);
@@ -80,7 +80,7 @@ public:
uint atEnd : 1;
QVector<QHash<int, QVariant> > headers;
QVarLengthArray<int, 56> colOffsets; // used to calculate indexInQuery of columns
- bool resetting;
+ int nestedResetLevel;
};
// helpers for building SQL expressions