Results 1 to 3 of 3

Thread: Choice between Standard- and Abstract Item Model

  1. #1
    Join Date
    Jun 2008
    Posts
    26
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Choice between Standard- and Abstract Item Model

    hey folks,

    i dont know which item model i have to chose / which one is the best for my issue. i've got a tree-view in which i would like to display some objects (which i create when loading files). but i want to have access through these objects: for example selecting one item should allow the user to "look into" the object, work with it and so on. also drag and drop should be possible. i hope you can imagine what i try to explain. up to the present i work with the QAbstractItemModel which causes many problems. Somebody has told me that the QModelIndexes are blame for that. can you help me? do you have an idea which one's "better" - or does somebody even have experience with both models?

    regards & thanks in advance

    sebastian

  2. #2
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Choice between Standard- and Abstract Item Model

    From what I can possible understand from what you're talking about. You will need to return the Flags to allow the options in the flags() of the QAbstractItemModel; QAbstractItemModel's just provide the basic and you have to do pretty much all the implementation yourself. While the standard does it for you. But you would need to subclass it and override the drag functions for drag and drop. and edit the flags() also.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  3. #3
    Join Date
    Jun 2008
    Posts
    26
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Choice between Standard- and Abstract Item Model

    Thank you very much.

    Do you know the difference between the QModelIndex and QPersistentModelIndex and do you have practice using it? It would be great if you could help me again...

    edit: i just found out, that qpersistent model indexes are destroyed when refreshing the view. but refreshing the view is actually not necessary, is it? (if i insert an item the view is not resettet, right?)

    Sebastian
    Last edited by hunsrus; 16th March 2009 at 15:23. Reason: updated contents

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.