Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 4 Support (Qt 6) › Custom TreeView items in QML

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #25231

    Martin

    Hi,

    is there a chance to create a TreeView including some extra icons / buttons. I want to check / select nodes and their children. Or is it possible to use custom items per node? An example would be very helpful.

    Thank you
    Martin

    #25233

    Günther
    Felgo Team
    #25234

    Martin

    Hi Günther,

    thank you. But since I have to deal with tree structures I thought the TreeView is the correct item. Otherwise I have to implement the tree structures by myself in the ListView. That’s very hard work to do.

    Kind regards
    Martin

    #25235

    Günther
    Felgo Team

    Sure, TreeView is also a viable choice if it fits your use-case and model setup better. I am not familiar with the specific customisation options or limitations, but it is possible to use own delegates similar to the ListView. Generally own delegate are the way to go when customising views.

    Qt 5 TreeView has an itemDelegate, rowDelegate and headerDelegate properties: https://doc.qt.io/qt-5/qml-qtquick-controls-treeview.html

    For Felgo 4 and Qt 6, the control was changed and supports a TreeView::delegate: https://doc.qt.io/qt-6/qml-qtquick-treeview.html.

    #25236

    Martin

    Sounds good. Is there an example I can start with? I’m struggling with the model. Do I have to create it by myself in C++?

    #25237

    Günther
    Felgo Team

    Yes, the TreeView expects a custom C++ model based on QAbstractItemModel. I don’t have an example at hand, but it is generally more complex than the ListView, where you can have a QML ListModel or JS array as the data source.

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded