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. implementing a custom "model" for a view
Forum Update on Monday, May 27th 2025

implementing a custom "model" for a view

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 340 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.
  • Z Offline
    Z Offline
    Zeplinn
    wrote on last edited by
    #1

    Hi
    I am new to qt (qtquick2 5.10) but got previous experience in .net WPF, with the idea of separating the ViewModel from the view.
    I am in need of having a list of model data where each instantiated item delegate freely can move between a number of different listViews. A custom implementation resembling the DelegateModel where each view can have its own DelegateModelGroup .

    the qt documentation details how to implement/subclass from the QAbstrictItemModel family, for maintaining data changes within a list and it members.
    Implementing this is not a problem and connecting it directly with a ListView, GridView, etc or through the DelegateModel.

    What i cant find any info on in the documentation is how or what the "model" property/type actually works and more important how to implement one for a custom view, to later be hooked up with an implementation of QAbstractItemModel.

    for the following questions assume the use of a QAbstractItemModel to be used, referred to as list:
    a delegate item in a ViewList usually have access to an attached property model/modelData (an index in the list). it is managed by the data(), setData() and roleNames() of the list.
    How would you in C++ attach such an index to be used in the same manor with a custom View implementation for its delegate through an attached property?

    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