QAbstractTableModel and the "QModelIndex parent" parameter
Unsolved
General and Desktop
-
Hi,
if the custom model underlying a QTableView changes the number of rows or columns (in my rows in my case), the QTableView needs to be informed in some fashion in order to provide the display the rows correctly. The documentation says that there is the option to implement insertRows or to write custom code and calling beginInsertRows from there.
If I chose the second option, would I have to pass the "QModelIndex parent" parameter to beginInsertRows? Apart from that, the documentation also tells me, that rowCount or columnCount should return 0, if the parent QModelIndex parameter is valid. Why?
Kind regards,
Andreas
-
Hi,
There's no reason to have a parent in a table model. Parents only have sens in a tree type model.