PDA

View Full Version : I have a question regarding models, QTreeWidgets and XML



Xagen
19th March 2006, 18:12
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!

jacek
19th March 2006, 18:17
Yes, but you will have to use QTreeView instead of QTreeWidget.

Xagen
19th March 2006, 18:25
But why, I don't understand?

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

jacek
19th March 2006, 18:29
But why, I don't understand?
Because QTreeWidget has its own predefined model that uses QTreeWidgetItems.


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

Xagen
19th March 2006, 18:34
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?

jacek
19th March 2006, 18:39
You can share it between multiple views and it can implement an interface that is more useful for you than operating on QTreeWidgetItems.

Xagen
19th March 2006, 18:41
Aha.
Thanks.