[PySide] parenting widgets explicitly vs adding to layout

Frank Rueter | OHUfx frank at ohufx.com
Sat May 26 07:50:44 CEST 2018


Sorry, I don't know why this always happens to me.
Right after sending this I found that there was a questionable custom 
sizeHint() implementation in the TableView() class which seems to have 
cause the problem.


On 26/05/18 5:41 PM, Frank Rueter | OHUfx wrote:
>
> Hi,
>
> I may have adopted a bad habit and would like to get clarification 
> from some pros:
>
> Once upon a time I was told (or assumed - I can’t remember), that 
> creating a widget without a parent is fine if you add it to the 
> parent’s layout straight away anyway.
> E.g.:
>
> |self.table = TableView() self.layout().addWidget(self.table) |
>
> However, I am now looking at some code where the parent widget’s 
> default size is very different compared to it's size when I create 
> children with "self" as the  explicit parent e.g.:
>
> |self.table = TableView(self) self.layout().addWidget(self.table) |
>>
> The latter opens the parent widget too small, and I have to increase 
> it's height to show the entire table, the former opens up larger.
> Is this to be expected? If so, where should I read up to understand 
> the logic?
>
> Or is this unexpected behaviour and the two examples should yield the 
> same result?
>
> Cheers,
> frank
>
> -- 
>
> ohufxLogo 50x50 <http://www.ohufx.com> 	
> 	*vfx compositing <http://ohufx.com/compositing.html> | *workflow 
> customisation and consulting <http://ohufx.com/customising.html>* *
> 		*<http://ohufx.com/compositing.html>*
> <http://www.nukepedia.com/nubridge> 	
> 	
>
> Your gateway to over 1,000 free tools... right inside of Nuke 
> <http://www.nukepedia.com/nubridge>
>
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20180526/dc2f795b/attachment.html>


More information about the PySide mailing list