LumaPictures / usd-qt

Reusable Qt Components for Pixar's USD
Other
153 stars 41 forks source link

HierarchyStarndardModel: hard-coded aestetic choices #8

Closed csaez closed 2 years ago

csaez commented 6 years ago

Hi there,

I've been reworking our integration with the outliner widget at work (Animal Logic) and found out that the StandardHierarchyModel is hardcoding these values as constants in the model itself instead of using a delegate (the previous approach).

https://github.com/LumaPictures/usd-qt/blob/35b01eaf71c5ebaf6262892ddc5584a5cae45184/pxr/usdQt/hierarchyModel.py#L272-L280

Are there any plans to move this logic out of the model itself (i.e. QItemDelegate) so we can take advantage of it without having to re-implement it? If that's not the case, would you accept a pull request making those changes?

Cheers!

nrusch commented 6 years ago

Hey @csaez, I don't want to put words in the author's mouth, but I believe the HierarchyStandardModel was meant to serve as an example of a generic but functional hierarchy model implementation that doesn't necessarily require a custom delegate implementation in order to be "presentable".

If you're interested in (or are already) using a custom delegate, you would likely be better off starting from HierarchyBaseModel, which provides the foundational functionality without really having much of an opinion about what/how data should be displayed.

That said, we're certainly open to ideas that can improve any of the base functionality, particularly by others who are actively using the code.

csaez commented 6 years ago

Hi Nathan,

I see, thanks for sharing a bit of context around these choices.

I ended up following your advise and subclassing HierarchyBaseModel + a delegate, it was very straight forward to do and it seems to work pretty well :+1:

Thanks for the help! Cesar