(Sorry for my late response but I had to take a couple of days off.)
Are you sure you aren't mixing up the access to the underlying data structures somehow?
I have check this a couple of times. The method rowCount() returns the correct value. And the data in the table and the node tree are correct to.
See below why you are right about this.
If you add two rows to the Output table, do you see two ghost rows in the Input table?
Yes. Looks like the grid is drawn from the sum of all data rows over both tables.
What happens if you remove an Output row?
Good question, have to check it. (Need to implement this anyway.) If I remove all rows (clear all nodes) then the ghost grid is still there.
After some impl. time...
During implementing the removeRow() method, I saw a bugs in the node insert handling.
The underling Node tree structure calls a callback to inform about changes in the data. My model gets informed before and after new Nodes are inserted. The callback method in the model looks like this:
void ExtendedSignalModel::OnNodeBeforeInsert(DataChangeInfo a_info)
{
if(!NodeIsHandledHere(a_info.node1))
{
return;
}
beginInsertRows
(QModelIndex(), a_info.
row, a_info.
row);
m_CallEndInsertRows = true;
}
void ExtendedSignalModel::OnNodeBeforeInsert(DataChangeInfo a_info)
{
if(!NodeIsHandledHere(a_info.node1))
{
return;
}
beginInsertRows(QModelIndex(), a_info.row, a_info.row);
m_CallEndInsertRows = true;
}
To copy to clipboard, switch view to plain text mode
The problem here is that the a_info.row value is not the model-row but the row (or index) in the internal Node data list which contains both, the input and output nodes.
Looks like the TableView uses the information from beginInsertRows() to draw the grid, not the rowCount().
Fixing this is not so easy, need to do some thinking.
I will comeback to you when this is done. I'm certain that this is the problem.
Thanks for all the help so far.
Bookmarks