Hi, a correction on the understanding. Its not 100 rows insertion at a time to the model.
A single pair of beginInsertRows() and endInsertRows() with 1 row at a time. The entire insertion is happening in a loop of count 100.
Is that the problem ?
Hi, a correction on the understanding. Its not 100 rows insertion at a time to the model.
A single pair of beginInsertRows() and endInsertRows() with 1 row at a time. The entire insertion is happening in a loop of count 100.
Is that the problem ?
Of course.Qt Code:
beginInsertRows(); Loop.... endInsertRows();To copy to clipboard, switch view to plain text mode
As Lesiok said, yes, of course. What you are doing is forcing the UI to update with -every- new row. Do as he suggests - call beginInsertRows() with a row count of 100, add the rows to your internal model, then call endInsertRows() to update the UI.Is that the problem ?
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
What will be the first and last index do I need to give in beginInsertRows() ,If I am trying to append 100 nodes to parent.
Currently my code is
beginInsertRows(parent, 0, 0);
for ()
{
parentNode->AppendChild(child));
}
endInsertRows();
Your code is incorrect. Read the documentation. QAbstractItemModel::beginInsertRows() explains it.If I am trying to append 100 nodes to parent.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks