Results 1 to 3 of 3

Thread: QAbstractItemModel Using External QList Examples

  1. #1
    Join Date
    May 2009
    Location
    Memphis, TN
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QAbstractItemModel Using External QList Examples

    What I need is something that is probably common, so I am hoping someone can post some example source code. (All the examples I found use an internal data source.)

    1.) Create a class User with multiple fields (code, name, password, etc.)
    2.) I want to create a QList of User objects -- m_UserList
    3.) Create a class UserModel : public QAbstractItemModel
    4.) Display the the User List in a QTreeView using the UserModel. (read only)

    I want the QTreeView to change when I update, add, and remove items in the m_UserList.

    The example I am looking is a QAbstractItemModel class using in an external QList of class objects.

    Thank you, Jeff.

  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: QAbstractItemModel Using External QList Examples

    There is no generic model like that (although I have written a generator for such cases but I can't share the code) although it should be easy to provide a skeletal implementation of such a model.
    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.


  3. #3
    Join Date
    May 2009
    Location
    Memphis, TN
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QAbstractItemModel Using External QList Examples

    Yes, if you have time, please post a skeleton. I can see many uses for such a model, and I am sure others would benefit too. I will post my code -- If I come up with a working implementation. Thanks, Jeff.

Similar Threads

  1. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 17:50
  2. shared vs static
    By alisami in forum Installation and Deployment
    Replies: 3
    Last Post: 4th October 2008, 13:04
  3. Replies: 16
    Last Post: 23rd May 2008, 10:12
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04

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.