Results 1 to 2 of 2

Thread: Help choosing a model type for QTableView

  1. #1
    Join Date
    Jul 2007
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Question Help choosing a model type for QTableView

    I have been searching forums with no luck trying to find the type of model to use for my custom class. My intent is to use it as a model for a QTableView. First things first. here is what the class looks like (simple - 6 private members):
    Qt Code:
    1. myClass{
    2. QString mystring;
    3. double myDouble1;
    4. double myDouble2;
    5. double myDouble3;
    6. double myDouble4;
    7. double myDouble5;
    8. }
    To copy to clipboard, switch view to plain text mode 

    I would like to construct a model that can hold a few of these "myClass" objects. I have looked at (and tried to implement)QAbstractListModel and looked a little at QAbstractItemModel but don't know which way would be better.??? This will be a read-only model, although I will want to use a couple values from each object when user is done adding all the "myClass" objects they desire.
    Thanks in advance - Goes2BoB

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help choosing a model type for QTableView

    If you want to represent objects as rows and member variables as columns, you need QAbstractTableModel subclass.

Similar Threads

  1. dummy question(Error)
    By Masih in forum Qt Programming
    Replies: 12
    Last Post: 19th July 2007, 23:38

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
  •  
Qt is a trademark of The Qt Company.