Qt World Summit: Submit your Presentation

QML force delegate instantiation

  • I have a ListView inside Scrollview and a delegate which instantiates items of ListView.

    After model change I want to force instantiation of delegates for all items in the model. I use cacheBuffer, so instantiated items won't gone.

    So the question is how can I achieve that?

  • Moderators

    You should not want that. Delegates are only a visual representation of the model, and ListView is designed to only show (and instantiate) what the user needs to see. Forcing it to show everything will decrease performance.

    If you definitely need to generate UI for all elements in a model, use Repeater.

Log in to reply