Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to instantiate recursive component with QML Instantiator?
Qt 6.11 is out! See what's new in the release blog

How to instantiate recursive component with QML Instantiator?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 743 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Igor Baidiuk
    wrote on last edited by
    #1

    Hello!

    I need to instantiate recursive tree of components in QML which are not derived from Item. The only way seems to be Instantiator. Unfortunately when I try code like this:

    // MyCustomGroup.qml
    import QtQml.Models 2.15
    
    MyGroup {
        id: entity
        property var model
        
        Instantiator {
            model: MyListItemModel { model: entity.model.children }
            MyCustomGroup {
                model: model.display
            }
        }
    }
    

    I receive QML loading error:

    MyCustomGroup is instantiated recursively

    Unfortunately I cannot use Loader component to break this recursion as my types are derived from QObject.

    Any ideas?

    Thanks

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved