Reputation: 161
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?
Upvotes: 3
Views: 2555
Reputation: 120718
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)
Upvotes: 6