Can QAbstractItemModel.beginInsertRows() be given an overestimate of the number of rows to be inserted?

57 Views Asked by At

I am using a custom QSqlTableModel class to edit an SQL table, which has certain constraints (e.g. a UNIQUE constraint). Because of these SQL constraints, at the time .insertRows() is called on a new batch of rows, it is not known which (or how many) of those rows will be successfully inserted. Therefore, when reimplementing the .insertRows() function, is it kosher to give .beginInsertRows() the upper limit of the number of rows which will be inserted, or will this cause problems down the line?

See https://doc.qt.io/qtforpython/PySide6/QtCore/QAbstractItemModel.html#PySide6.QtCore.PySide6.QtCore.QAbstractItemModel.beginInsertRows

0

There are 0 best solutions below