def __init__(self, *args, **kw): super(ComboBoxWidget, self).__init__(*args, **kw) layout = QHBoxLayout() layout.setSpacing(2) self.combo = combo = QComboBox() combo.setSizeAdjustPolicy(QComboBox.AdjustToContents) combo.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.button = button = QPushButton() button.setEnabled(False) button.setIcon(icon('add').create_icon()) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(20) button.setFixedHeight(20) layout.addWidget(combo) layout.addSpacing(10) layout.addWidget(button) self.setLayout(layout)
def _create_control(self, parent): """ Create the toolkit-specific control that represents the widget. """ control = QComboBox(parent) control.setInsertPolicy(QComboBox.NoInsert) control.setEditable(False) return control