How to update QTableView when rows are inserted to it
-
@kshegunov : I mean't view side caching.
@Ratzz currently you are not inserting anything through it. Like @kshegunov suggested, implement the drag and drop through the mechanism provided for model/view classes. It's described here
-
No i have not considered this part.
Then I suggest you try it out. It may prove to be easier and better behaved than pulling the records directly from the tree widget. As for your current implementation, I'm at a loss why it doesn't work. Maybe the tree view is losing the selection when dragging and the selection model returns no records?
I mean't view side caching.
I see, well I didn't look at the view (obviously) but I suppose it's possible.
-
Hi
I am still wondering. Sorry.
Lets say If I dont have drag&drop.I simply append to my internal list used in model.
How will I tell the view(s) that?
I though dataChanged would do it but not even begin/endInsertRow
does it.Thanks
-
On a side note, your rowCount implementation should rather return the size of your TableList, that way it's one less thing to manage.
-
In
dropEvent
called a new function from model which stores all the parameter of item when droped and emitted layoutAboutToBeChanged() before appending to my TableList and then emitted layoutChanged() which worked for me.Thanks to @kshegunov , @SGaist , @mrjj for the help.