Handling layouts inside a custom layout.
-
I have made a custom layout which does relative scaling. This works for widgets which are added to the layout, but I have been having trouble getting layouts to work inside my custom layout. I have an addLayout() method:
def addLayout(self, layout: QLayout): for index in range(0, layout.count()): item = layout.itemAt(index) self.addItem(item)
Where by I add all the children widgets in the passed layout to my custom layout. I want my custom layout to handle the size of all the children widgets but the original layout to still handle the position of its children widgets. Currently in the method that handles the sizing, I call setGeometry on each widget to resize them, but any widget inside of another layout does not render.
item.setGeometry(scaled_item)
Any pointers on how to handle layouts within custom layouts would be greatly appreciated.
-
@yekta said in Handling layouts inside a custom layout.:
I want my custom layout to handle the size of all the children widgets but the original layout to still handle the position of its children widgets
How should this work? A widget can only be part of ONE layout at a time. You can't use two layouts to manage same widgets.