def __init__(self, text, items_list = None, default_item = None, parent = None):
"""
Initialization of the CfgComboBox class (drop-down menu).
@param text: text string associated with the combobox
@param items_list: string list containing all the available options
@param default_item: string containing the default selected item
"""
QWidget.__init__(self, parent)
self.combobox = QComboBox(parent)
if isinstance(items_list, (list, tuple)):
self.setSpec({'string_list': items_list, 'comment': ''})
if default_item is not None:
self.setValue(default_item)
self.label = QLabel(text, parent)
self.layout = QHBoxLayout(parent);
self.combobox.setMinimumWidth(200) #Provide better alignment with other items
self.layout.addWidget(self.label)
self.layout.addStretch()
self.layout.addWidget(self.combobox)
self.setLayout(self.layout)
评论列表
文章目录