Follow-up to 83c9ebbd66.
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 83c9ebbd66, 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>