[Interest] Regarding QtreeWidget
André Somers
andre at familiesomers.nl
Fri Mar 4 17:24:09 CET 2016
Op 04/03/2016 om 13:20 schreef william.crocker at analog.com:
> On 03/04/2016 03:06 AM, Roshni Lalwani wrote:
>> I have application in which I am planning to use a QtreeWidget . The
>> maxinum
>> number of elements in the treeWidget can go uptp 500 . COuld you let
>> me how will
>> be performance of using QtreeWidget for 500 elements . Will it lead
>> to some
>> performance degradation
>>
>
> Use a QTreeView with an underlying model and performance of the tree
> widget
> will no longer be a concern.
Nonsense.
It all depends on your implementation of the model then, and writing
good tree models is not trivial. I agree that generally a "real" model
is much to be prefered, but your statement as-is doesn't make much sense
to me.
I think the merrits of QTreeWidget (and all the view like Q*Widget
classes) is debatable, but I don't think performance is the major pain
point here. I would recommend to consider using QStandardItemModel with
a QTreeView instead if you like the item-based API that much. Also,
consider wrapping it up in your own model subclass with a sane API that
suits your application, instead of filling and accessing your model from
different places in otherwise unrelated code. This will make it easier
to swap out the QStandardItemModel based model for a custom model later
on if needed.
André
More information about the Interest
mailing list