Results 1 to 7 of 7

Thread: I have a question regarding models, QTreeWidgets and XML

  1. #1
    Join Date
    Jan 2006
    Location
    Minsk, Brest, Belarus
    Posts
    54
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Red face I have a question regarding models, QTreeWidgets and XML

    Hi, guys!
    I'm writing a book-collection manager now in QT4. And I have a question:
    should I use a custom (QAbstractItemModel...) model in my app when I read/save data in xml file to/from my QTreeWidget?

    Thanks in advance!

  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: I have a question regarding models, QTreeWidgets and XML

    Yes, but you will have to use QTreeView instead of QTreeWidget.

  3. #3
    Join Date
    Jan 2006
    Location
    Minsk, Brest, Belarus
    Posts
    54
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Red face Re: I have a question regarding models, QTreeWidgets and XML

    But why, I don't understand?

    And another question in advance - how to read the data from the xml file to the model?

  4. #4
    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: I have a question regarding models, QTreeWidgets and XML

    Quote Originally Posted by Xagen
    But why, I don't understand?
    Because QTreeWidget has its own predefined model that uses QTreeWidgetItems.

    Quote Originally Posted by Xagen
    And another question in advance - how to read the data from the xml file to the model?
    http://www.qtcentre.org/forum/showthread.php?t=1297

  5. #5
    Join Date
    Jan 2006
    Location
    Minsk, Brest, Belarus
    Posts
    54
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Red face Re: I have a question regarding models, QTreeWidgets and XML

    Quote Originally Posted by jacek
    Because QTreeWidget has its own predefined model that uses QTreeWidgetItems.


    http://www.qtcentre.org/forum/showthread.php?t=1297
    I understood this.
    I was asking why to use model?
    What are the pluses of using model?

  6. #6
    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: I have a question regarding models, QTreeWidgets and XML

    You can share it between multiple views and it can implement an interface that is more useful for you than operating on QTreeWidgetItems.

  7. The following 2 users say thank you to jacek for this useful post:

    gfunk (19th April 2006), Xagen (19th March 2006)

  8. #7
    Join Date
    Jan 2006
    Location
    Minsk, Brest, Belarus
    Posts
    54
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Talking Re: I have a question regarding models, QTreeWidgets and XML

    Aha.
    Thanks.

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.