Skip to content

Slow extend() for EventedList and friends #419

Description

@ndxmrb

Hi,
I want to insert a batch of objects into a SelectableEventedList, but I want to fire corresponding signals only once, not for each object. The purpose is to reduce update calls in widgets down the line.

I thought I'd use paused() with a reducer to collect all indexes. But inserting currently only takes an index: int, not a tuple.

Question: How can I defer signal emission properly, such that Qt models update properly?

I tried blocking, but then you need to decide what to emit when done.

Or should I rather try to throttle the model functions?

Suggestion: inserting etc. could accept tuples as well, such that Qt's beginInsertRows() and endInsertRows() can be used to reduce update calls. extend() could then make use of this directly, such that it only emits the inserted signal once.

Thanks in advance,
ndxmrb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions