Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]One-to-Many QProxyModel
QtWS25 Last Chance

[SOLVED]One-to-Many QProxyModel

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • M Offline
    M Offline
    Milovidov
    wrote on last edited by
    #1

    Hello all!

    Is exist way for creating subclass of QAbstractProxyModel for many-to-one relationship? It means that for each item from source model will be exist several items in proxy model.

    I saw mapFormSource method, but it return strictly only one item for each item in source model. How to return in this method several items or which ways are exist for my target?

    Thanks for your attention!

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pritamghanghas
      wrote on last edited by
      #2

      I dont think you can do that and still use lot from QAbstractProxyModel. I think you will have to do your own proxy model directly subclassing from QAbstractItemModel. Basically wrapping your source model in object proxy design pattern. Can be done but it will be non trivial work and good amount of testing.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Milovidov
        wrote on last edited by
        #3

        I found a good solution. I can just create subclass from source model and redefine data and setData methods.

        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