From a given widget, is it possible to get the layout that contains it?
I'm doing a dynamic form, and my widget hierarchy looks like:
QDialogBox
|- QVBoxLayout
|- QHBoxLayout 1
|- Widget 1
|- Widget 2
|- ...
|- QHBoxLayout 2
|- Widget 1
|- Widget 2
|- ...
|- ...
If I receive a signal from Widget 1
or Widget 2
, I can identify it using sender()
function. I'd like to be able to adjust some properties of other widgets on the same line. How can I get a reference to the QHBoxLayout
containing a given widget?
parent()
property gives me the QDialogBox
, since the parent of a widget cannot be a layout. layout()
property gives me None
, since it refers to the contained layout, not the containing layout.