@@ -215,7 +215,7 @@ void QgsAttributeTableDialog::on_mSelectedToTopButton_clicked()
215215#endif
216216
217217 // just select proper rows
218- // mModel->reload(mModel->index(0,0), mModel->index(mModel->rowCount(), mModel->columnCount()));
218+ // mModel->reload(mModel->index(0,0), mModel->index(mModel->rowCount() - 1 , mModel->columnCount() - 1 ));
219219 // mModel->changeLayout();
220220 mModel ->resetModel ();
221221 updateSelection ();
@@ -677,7 +677,7 @@ void QgsAttributeTableDialog::editingToggled()
677677 mAddFeature ->setEnabled ( canAddFeatures && mLayer ->isEditable () && mLayer ->geometryType () == QGis::NoGeometry );
678678
679679 // (probably reload data if user stopped editing - possible revert)
680- mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount (), mModel ->columnCount () ) );
680+ mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount () - 1 , mModel ->columnCount () - 1 ) );
681681
682682 // not necessary to set table read only if layer is not editable
683683 // because model always reflects actual state when returning item flags
@@ -700,7 +700,7 @@ void QgsAttributeTableDialog::revert()
700700{
701701 mLayer ->rollBack ();
702702 mModel ->revert ();
703- mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount (), mModel ->columnCount () ) );
703+ mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount () - 1 , mModel ->columnCount () - 1 ) );
704704}
705705
706706void QgsAttributeTableDialog::on_mAddAttribute_clicked ()
@@ -724,7 +724,7 @@ void QgsAttributeTableDialog::on_mAddAttribute_clicked()
724724 mLayer ->destroyEditCommand ();
725725 }
726726 // update model - a field has been added or updated
727- mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount (), mModel ->columnCount () ) );
727+ mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount () - 1 , mModel ->columnCount () - 1 ) );
728728 }
729729}
730730
@@ -765,7 +765,7 @@ void QgsAttributeTableDialog::on_mRemoveAttribute_clicked()
765765 mLayer ->destroyEditCommand ();
766766 }
767767 // update model - a field has been added or updated
768- mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount (), mModel ->columnCount () ) );
768+ mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount () - 1 , mModel ->columnCount () - 1 ) );
769769 }
770770}
771771
@@ -778,8 +778,10 @@ void QgsAttributeTableDialog::on_mOpenFieldCalculator_clicked()
778778
779779 if ( col >= 0 )
780780 {
781- mModel ->reload ( mModel ->index ( 0 , col ),
782- mModel ->index ( mModel ->rowCount (), col ) );
781+ QModelIndex idx0 = mModel ->index ( 0 , col );
782+ QModelIndex idx1 = mModel ->index ( mModel ->rowCount () - 1 , col );
783+
784+ mModel ->reload ( idx0, idx1 );
783785 }
784786 }
785787}
@@ -794,7 +796,7 @@ void QgsAttributeTableDialog::addFeature()
794796 QgsFeatureAction action ( tr ( " Geometryless feature added" ), f, mLayer , -1 , -1 , this );
795797 if ( action.addFeature () )
796798 {
797- mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount (), mModel ->columnCount () ) );
799+ mModel ->reload ( mModel ->index ( 0 , 0 ), mModel ->index ( mModel ->rowCount () - 1 , mModel ->columnCount () - 1 ) );
798800 }
799801}
800802
0 commit comments