Parameters ---------- data : list of (label, value) pairs The data to be edited in the form. comment : str, optional with_margin : bool, default: False If False, the form elements reach to the border of the widget. This is
(self, data, comment="", with_margin=False, parent=None)
| 212 | update_buttons = QtCore.Signal() |
| 213 | |
| 214 | def __init__(self, data, comment="", with_margin=False, parent=None): |
| 215 | """ |
| 216 | Parameters |
| 217 | ---------- |
| 218 | data : list of (label, value) pairs |
| 219 | The data to be edited in the form. |
| 220 | comment : str, optional |
| 221 | with_margin : bool, default: False |
| 222 | If False, the form elements reach to the border of the widget. |
| 223 | This is the desired behavior if the FormWidget is used as a widget |
| 224 | alongside with other widgets such as a QComboBox, which also do |
| 225 | not have a margin around them. |
| 226 | However, a margin can be desired if the FormWidget is the only |
| 227 | widget within a container, e.g. a tab in a QTabWidget. |
| 228 | parent : QWidget or None |
| 229 | The parent widget. |
| 230 | """ |
| 231 | super().__init__(parent) |
| 232 | self.data = copy.deepcopy(data) |
| 233 | self.widgets = [] |
| 234 | self.formlayout = QtWidgets.QFormLayout(self) |
| 235 | if not with_margin: |
| 236 | self.formlayout.setContentsMargins(0, 0, 0, 0) |
| 237 | if comment: |
| 238 | self.formlayout.addRow(QtWidgets.QLabel(comment)) |
| 239 | self.formlayout.addRow(QtWidgets.QLabel(" ")) |
| 240 | |
| 241 | def get_dialog(self): |
| 242 | """Return FormDialog instance""" |