@@ -25,7 +25,7 @@ RoleCombineModel::RoleCombineModel(QAbstractItemModel *major, QAbstractItemModel
25
25
26
26
connect (sourceModel (), &QAbstractItemModel::rowsInserted, this , [this , majorRoles, func](const QModelIndex &parent, int first, int last) {
27
27
beginInsertRows (index (parent.row (), parent.column ()), first, last);
28
- for (int i = first; i < last; i++) {
28
+ for (int i = first; i <= last; i++) {
29
29
QModelIndex majorIndex = sourceModel ()->index (i, 0 );
30
30
QModelIndex minorIndex = func (majorIndex.data (majorRoles), m_minor);
31
31
if (majorIndex.isValid () && minorIndex.isValid ())
@@ -35,7 +35,7 @@ RoleCombineModel::RoleCombineModel(QAbstractItemModel *major, QAbstractItemModel
35
35
});
36
36
connect (sourceModel (), &QAbstractItemModel::columnsInserted, this , [this , majorRoles, func](const QModelIndex &parent, int first, int last) {
37
37
beginInsertColumns (index (parent.row (), parent.column ()), first, last);
38
- for (int j = first; j < last; j++) {
38
+ for (int j = first; j <= last; j++) {
39
39
QModelIndex majorIndex = sourceModel ()->index (0 , j);
40
40
QModelIndex minorIndex = func (majorIndex.data (majorRoles), m_minor);
41
41
if (majorIndex.isValid () && minorIndex.isValid ())
@@ -46,7 +46,7 @@ RoleCombineModel::RoleCombineModel(QAbstractItemModel *major, QAbstractItemModel
46
46
47
47
connect (sourceModel (), &QAbstractItemModel::rowsRemoved, this , [this ](const QModelIndex &parent, int first, int last) {
48
48
beginRemoveRows (index (parent.row (), parent.column ()), first, last);
49
- for (int i = first; i < last; i++) {
49
+ for (int i = first; i <= last; i++) {
50
50
if (m_indexMap.contains (qMakePair (i, 0 ))) {
51
51
m_indexMap.remove (qMakePair (i, 0 ));
52
52
}
@@ -55,7 +55,7 @@ RoleCombineModel::RoleCombineModel(QAbstractItemModel *major, QAbstractItemModel
55
55
});
56
56
connect (sourceModel (), &QAbstractItemModel::columnsRemoved, this , [this ](const QModelIndex &parent, int first, int last) {
57
57
beginRemoveColumns (index (parent.row (), parent.column ()), first, last);
58
- for (int j = first; j < last; j++) {
58
+ for (int j = first; j <= last; j++) {
59
59
if (m_indexMap.contains (qMakePair (0 , j))) {
60
60
m_indexMap.remove (qMakePair (0 , j));
61
61
}
0 commit comments