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

Laszlo Papp lpapp at kde.org
Tue Nov 21 17:14:15 CET 2023


Hi Arno,

Thanks for the feedback.

I have personally never needed more than the TreeItem class from the
examples I referred to. I have worked on various trees on the GUI.

Apologies, perhaps, I have not made my inquiry clear. This is not calling
for opinions about TreeItem vs. QStandardItem vs. QTreeWidgetItem.

I mentioned a very specific class, where QTreeWidgetItem would seemingly
suffice for the simple and editable tree example.

I was asking about the use of those for these particular examples, not for
everything.

So, my question still stands for the context of these two examples: can the
outcome of these examples be the same with QTreeWidgetItem?

If the answer is no, we are done.

If the answer is yes, I would say, it is not a good example to show their
reinvention. In this case, I would either change the logic of the examples
to truly demonstrate something that cannot be done with a QTreeWidgetItem,
or just use that for this particular example.

So, just to summarise, I did not mean to launch a generic question about
custom tree items vs. built-in tree items Qt.

I was referring to this very specific use case.

Perhaps, your application and use cases are different from the simple and
editable examples, so the built-in items would not suffice your use case.
However, I am asking about the examples, not your use cases.

Hope that clarifies the context of my inquiry a bit more.

Thanks for the feedback.

On Tue, Nov 21, 2023 at 3:44 PM Arno Rehn <a.rehn at menlosystems.com> wrote:

> 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
>
> --
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20231121/c34897bf/attachment.htm>


More information about the Development mailing list