Data field widgets
dawiq.fieldwidgets provides widgets to represent the fields of the
dataclass. Widgets are compatible to dawiq.typing.FieldWidgetProtocol.
- class dawiq.fieldwidgets.BoolCheckBox(*args: Any, **kwargs: Any)[source]
Bases:
QCheckBoxCheckbox for fuzzy boolean value.
Check state of the box represents the field value. If the box is checked, the value is True. If unchecked, the value is False.
If tristate is enabled, setting
Noneas the field value sets the state asQt.PartiallyChecked. If tristate is disabled,Noneis treated asFalseand unchecks the box.
- class dawiq.fieldwidgets.EmptyIntValidator(*args: Any, **kwargs: Any)[source]
Bases:
QIntValidatorValidator which accpets integer and empty string
- class dawiq.fieldwidgets.IntLineEdit(*args: Any, **kwargs: Any)[source]
Bases:
QLineEditLine edit for integer value.
If the text is not empty, the field value is the integer that the text is converted to. If the line edit is empty or the text cannot be converted to integer,
Noneis the field value. SettingNoneas field value clears the line edit.
- class dawiq.fieldwidgets.EmptyFloatValidator(*args: Any, **kwargs: Any)[source]
Bases:
QDoubleValidatorValidator which accpets float and empty string
- class dawiq.fieldwidgets.FloatLineEdit(*args: Any, **kwargs: Any)[source]
Bases:
QLineEditLine edit for float value.
If the text is not empty, the field value is the float that the text is converted to. If the line edit is empty or the text cannot be converted to float,
Noneis the field value. SettingNoneas field value clears the line edit.
- class dawiq.fieldwidgets.StrLineEdit(*args: Any, **kwargs: Any)[source]
Bases:
QLineEditLine edit for string value.
If the line edit is empty, field data is empty string. Setting
Noneas the field value clears the widget.
- class dawiq.fieldwidgets.EnumComboBox(*args: Any, **kwargs: Any)[source]
Bases:
QComboBoxCombo box for
enum.Enumtype.Standard way to construct this widget is by
fromEnum()class method. N-th item contains N-th member of the Enum as its data.Enum instance is stored in item data. Field value is the data of currently activated item. If the current index is -1, field value is
None.
- class dawiq.fieldwidgets.TupleGroupBox(*args: Any, **kwargs: Any)[source]
Bases:
QGroupBoxGroup box for tuple with fixed length.
This is the group box which contains field widgets as subwidgets. Field value is the tuple of subwidgets values.
- widget(index: int) FieldWidgetProtocol | None[source]
Returns the subwidget at the given index, or None for invalid index.
- insertWidget(index: int, widget: FieldWidgetProtocol, stretch: int = 0, alignment: dawiq.qt_compat.QtCore.Qt.AlignmentFlag = dawiq.qt_compat.QtCore.Qt.AlignmentFlag)[source]
Insert the widget to layout and connect the signals.
- addWidget(widget: FieldWidgetProtocol, stretch: int = 0, alignment: dawiq.qt_compat.QtCore.Qt.AlignmentFlag = dawiq.qt_compat.QtCore.Qt.AlignmentFlag)[source]
Add the widget to layout and connect the signals.
- removeWidget(widget: FieldWidgetProtocol)[source]
Remove the widget from layout and disconnect the signals.