<div dir="ltr">Here is a small example.<br>I tried putting a vertical spacer on the bottom yet these stacked widgets want to take up space when resized.<br><br>#!/usr/bin/env python<br><br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br>
<br>class TestWidget(QWidget):<br>    def __init__(self, labels, parent=None):<br>        super(TestWidget, self).__init__(parent)<br><br>        layout = QGridLayout()<br>        for i, output in enumerate(labels):<br><br>
            layout.addWidget(QLabel(output), i, 0)<br>            combo = QComboBox()<br>            combo.addItems([<br>                "Slider",<br>                "Spinner",<br>            ])<br>            layout.addWidget(combo, i, 1)<br>
<br>            stack = QStackedWidget()<br><br>            horizontalSlider = QSlider()<br>            horizontalSlider.setOrientation(Qt.Horizontal)<br><br>            spinner = QSpinBox()<br><br>            spinner.valueChanged.connect(horizontalSlider.setValue)<br>
            horizontalSlider.valueChanged.connect(spinner.setValue)<br><br>            stack.addWidget(horizontalSlider)<br>            stack.addWidget(spinner)<br><br>            combo.currentIndexChanged.connect(stack.setCurrentIndex)<br>
<br>            layout.addWidget(stack, i, 2)<br><br>        vertical_spacer = QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)<br>        layout.addItem(vertical_spacer, len(labels), 0, 1, 3)<br><br>        self.setLayout(layout)<br>
<br>if __name__ == '__main__':<br>    import sys<br>    app = QApplication(sys.argv)<br>    ocw = TestWidget(['a', 'b', 'c', 'd', 'e'])<br>    ocw.show()<br>    sys.exit(app.exec_())<br>
<br></div>