Results 1 to 5 of 5

Thread: QTableView that display individual items

  1. #1
    Join Date
    Apr 2012
    Location
    France
    Posts
    13

    Exclamation QTableView that display individual items

    hi all

    First thanks to the community that always provide great help.

    I have a big problem using my QTableView while sorting.
    My table view is used to display a list of contacts, so they are individual items. I need to display those contacts in list mode and tile mode.

    I have all my contacts in a QObjectList, then I create a QAbstractTableModel that use this list as the model data and a QAbstractItemDelegate that paint the data.
    I need to sort the table view as well so I have created a QSortFilterProxyModel and set it to the table view.

    Then I call proxy->sort(0, ascending/descending) and my table is updated.

    Everything works fine in list mode, my model returns rowCount = the number of contacts and columnCount= 1.

    But there is a big problem while I want to display my items in tile mode, my model returns rowCount = ceil((float)number of contacts / 3); and columnCount= 3 then on the first columns contacts are well sorted but on other columns this is a mess, nothing is sorted correctly and I even have blank tile (or cell) in the middle of the table view.

    The same problem occurs while filtering the contact with the proxy.

    So My question is how can do that ? I even think that I can't do it with a table view because it needs to have the same data for a single row and display the data informations in the different columns.

    If I can't use a QTableView do I have to create a special widget with scrolling and put all my contacts in it ? Doing this make me sick because I have to implement clicks, sorts and filters by hand.

    Thanks for you reply anyway.

    Zal

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableView that display individual items

    Why you won't use list view which has list/icon view already implemented?

    No point reinventing the wheel.

  3. #3
    Join Date
    Apr 2012
    Location
    France
    Posts
    13

    Default Re: QTableView that display individual items

    Hi

    Do you talk about QListView ?

  4. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableView that display individual items


  5. #5
    Join Date
    Apr 2012
    Location
    France
    Posts
    13

    Default Re: QTableView that display individual items

    OMG

    thanks a lot, I was stuck with the table view and I never had a look to that class.

    Thank you so much

Similar Threads

  1. Display widget as items in a QListView
    By remy_david in forum Qt Programming
    Replies: 0
    Last Post: 10th January 2011, 10:23
  2. Replies: 1
    Last Post: 23rd September 2010, 20:16
  3. display graphics items on area
    By quantum.17 in forum Qt Programming
    Replies: 0
    Last Post: 5th May 2010, 11:19
  4. QTreeWidget Items display too wide.
    By chris_helloworld in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2010, 13:36
  5. How to display individual character of a string?
    By cooper in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2009, 05:19

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.