I found the culprit but not a solution yet:
When generating the list of items in my pre-process, I already parent them to each other for use in a QTreeView, e.g.:
    cur_root_item.setChild(item_counter, cur_file_item)

Turns out I can't just show all items in a simple list ignoring their parenting. How would I go about this then if I need both a "flat" list for a report print out and also tree view for the user to interact with, e.g.:

QListView would show (ignoring existing parenting):

 * itemA
 * itemB
 * itemC


QTreeView of the same model would show (based on previous parenting):
itemA
    |___itemB
            |____itemC

Do I need two models and communicate between them (e.g. if a user renames an item)?
Or can this be achieved with a single model?

Thanks,
frank


On 26/04/17 7:50 PM, Frank Rueter | OHUfx wrote:
Hi,

I seem to run into this issue a lot and I don't get why:
I have a list of sub-classed QStandardItems that another processor generated, and I want to add them to a QStandardItemModel like this:

for item in myItemList:
    self.model.appendRow(item)

The model is empty and hasn't been used at this point. Yet I get none of my items but one of those errors for each item:
    QStandardItem::insertRows: Ignoring duplicate insertion of item

I know I should know this but I can't figure out why this is happening. Is there something special I need to do when subclassing QStandardItem?


Cheers,
frank

--
<http://www.nukepedia.com>                

over 1,000 free tools for Nuke <http://www.nukepedia.com>

<https://vimeo.com/channels/nukepedia/165747936>          

full access from within... coming soon <https://vimeo.com/channels/nukepedia/165747936>



_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to