[Development] QtWidgets Item / Model / View: tree model examples

Arno Rehn a.rehn at menlosystems.com
Tue Nov 21 16:43:38 CET 2023


Hey Lazlo,

I've been working with various list and tree models a lot in recent 
years. I think I've never used QTreeWidgetItem and/or QStandardItem even 
once.
In my experience these classes or only viable for the most simple cases. 
I'd usually expect people to need a custom data structure holding their 
model data and the "standard" classes will not suffice. With that in 
mind, I think it's fine that the examples show just that.

Regards,
Arno

Am 21.11.2023 um 16:31 schrieb Laszlo Papp:
> Hi,
>
> The tree model examples seem to invent a custom tree item.
>
> Simple: 
> https://doc.qt.io/qt-6/qtwidgets-itemviews-simpletreemodel-example.html
> Edit: 
> https://doc.qt.io/qt-6/qtwidgets-itemviews-editabletreemodel-example.html
>
> at
>
> https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/itemviews/simpletreemodel/treeitem.h?h=6.6
>
> and
>
> https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/itemviews/editabletreemodel/treeitem.h?h=6.6
>
> ---
>
> Long time ago, I based my projects on these examples, inventing 
> (copying and pasting) these tree items.
>
> I wonder whether these examples could instead propagate the use of:
>
> 1. QTreeWidgetItem?
> 2. QStandardItem?
>
> It seems that e.g. the QTreeWidgetItem is nearly the same as the Tree 
> Item invented in those examples. So, why reinvent?
>
> Do you think that the tree item still has a good use case to exist in 
> those examples?
>
> If yes, what is it?
>
> If not, could we start propagating QTreeWidgetItem or QStandardItem in 
> those examples instead to avoid reinventing?
>
> Thank you in advance.
>
> Kind regards,
> László
>

-- 
Arno Rehn
Tel +49 89 189 166 0
Fax +49 89 189 166 111
a.rehn at menlosystems.com
www.menlosystems.com

Menlo Systems GmbH
Bunsenstrasse 5, D-82152 Martinsried, Germany
Amtsgericht München HRB 138145
Geschäftsführung: Dr. Michael Mei, Dr. Ronald Holzwarth
USt.-IdNr. DE217772017, St.-Nr. 14316170324



More information about the Development mailing list