[PySide] parenting widgets explicitly vs adding to layout

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


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>

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


More information about the PySide mailing list