I want to have a layout like the following:

I am using a QHBoxLayout and adding two widgets - but instead of the 25% / 75% layout that I require, both the widgets get 50% of the available space.
How do I distribute the area for the widgets unequally?
The QHBoxLayout and QVBoxLayout classes allow you to set a stretch factor when adding widgets. This specifies the relative proportion of space taken up by the widget, after the widget's minimum/maximum width/height has been taken into account:
layout = QHBoxLayout()
layout.addWidget(widget1, 25)
layout.addWidget(widget2, 75)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With