34 from python_qt_binding.QtWidgets
import \
35 QButtonGroup, QCheckBox, QGroupBox, QLabel, QVBoxLayout
40 Creates a button group of non-exclusive checkbox options.
42 Options must be a dict with following keys: 'enabled','title','description','tooltip'
45 def __init__(self, options, title='Checkboxes', selected_indexes=[], parent=None):
46 super(CheckBoxGroup, self).
__init__()
48 self.setLayout(QVBoxLayout())
55 for (button_id, option)
in enumerate(self.
_options):
57 checkbox = QCheckBox(option.get(
'title',
'option %d' % button_id))
58 checkbox.setEnabled(option.get(
'enabled',
True))
59 checkbox.setChecked(button_id
in selected_indexes)
60 checkbox.setToolTip(option.get(
'tooltip',
''))
63 parent.layout().addWidget(checkbox)
64 if 'description' in option:
65 parent.layout().addWidget(QLabel(option[
'description']))
68 """Return dictionary with selected_indexes (array) and selected_options (array) keys."""
72 if button.isChecked():
75 return {
'selected_indexes': selected_indexes,
'selected_options': selected_options}