Results 1 to 2 of 2

Thread: QAbstractProxyModel for data grouping

  1. #1
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default QAbstractProxyModel for data grouping

    My question is about transforming flat data to the hierarchical model. Namely, I have a list of books described by the title, the author, etc. I want to be able to group books by some of those fields. In order to achieve this I subclass QAbstractProxyModel. It seems to work, but the items that represent categories (e.g. item with the name of the author containing books written by that author) can't be selected or edited. It seems like it is somehow related to the absence of the source index corresponding to the proxy index. I was trying to override the flags method, but it didn't help. I overrode proxy model's setData method, so in case category items are modified the source model is properly updated, and when I change proxy model programmatically it works fine, so my goal is just to make GUI to allow selecting and editing those items. What should I change for this purpose?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QAbstractProxyModel for data grouping

    What do your mapFromSource() and mapToSource() methods look like?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QT View grouping like in WPF
    By malootki in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2011, 20:25
  2. Dynamic Grouping of QTableView Rows
    By stefanadelbert in forum Qt Programming
    Replies: 5
    Last Post: 7th December 2010, 06:15
  3. Grouping files
    By Jeffb in forum Newbie
    Replies: 4
    Last Post: 15th June 2010, 10:29
  4. Replies: 1
    Last Post: 3rd December 2009, 09:20
  5. Grouping Widgets Together
    By joshuajcarson in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2008, 20:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.