AbstractSpinBoxMixin
Sub classes
| Name |
Children |
Inherits |
AbstractSpinBox prettyqt.widgets.abstractspinbox Spinbox and a line edit to display values. |
|
|
SpinBox prettyqt.widgets.spinbox
|
|
|
DoubleSpinBox prettyqt.widgets.doublespinbox Spin box widget that takes doubles. |
|
|
DateTimeEditMixin prettyqt.widgets.datetimeedit Widget for editing dates and times. |
|
|
Base classes
| Name |
Children |
Inherits |
WidgetMixin prettyqt.widgets.widget
|
|
|
object builtins The base class of the class hierarchy. |
- type
async_generatorbytearray_iterator- bytearray
bytes_iterator- bytes
builtin_function_or_methodcallable_iteratorPyCapsulecellclassmethod_descriptor- ...
|
|
â‹” Inheritance diagram
graph TD
2425936479["widgets.AbstractSpinBoxMixin"]
829357528["widgets.WidgetMixin"]
3227531497["core.ObjectMixin"]
2751680898["builtins.object"]
625385617["gui.PaintDeviceMixin"]
829357528 --> 2425936479
3227531497 --> 829357528
2751680898 --> 3227531497
625385617 --> 829357528
2751680898 --> 625385617
2751680898 --> 829357528
2751680898 --> 2425936479
🛈 DocStrings
Bases: WidgetMixin, _AbstractSpinBoxBase
Source code in prettyqt/widgets/abstractspinbox.py
| class AbstractSpinBoxMixin(widgets.WidgetMixin, _AbstractSpinBoxBase):
def __init__(self, *args, show_group_separator: bool = True, **kwargs):
super().__init__(*args, show_group_separator=show_group_separator, **kwargs)
self.setLineEdit(widgets.LineEdit(parent=self))
def _get_map(self):
maps = super()._get_map()
maps |= {
"alignment": constants.ALIGNMENTS,
"buttonSymbols": SYMBOLS,
"correctionMode": CORRECTION_MODES,
}
return maps
def is_valid(self) -> bool:
return self.hasAcceptableInput()
def set_validator(
self, validator: QtGui.QValidator | widgets.lineedit.ValidatorStr | None, **kwargs
) -> QtGui.QValidator | None:
# prettyqt installs its own LineEdit
line_edit = cast("widgets.LineEdit", self.lineEdit())
return line_edit.set_validator(validator, **kwargs)
def get_button_symbols(self) -> SymbolStr:
"""Return button symbol type.
Returns:
button symbol type
"""
return SYMBOLS.inverse[self.buttonSymbols()]
def set_button_symbols(self, mode: SymbolStr | QtWidgets.QSpinBox.ButtonSymbols):
"""Set button symbol type.
Args:
mode: button symbol type to use
"""
self.setButtonSymbols(SYMBOLS.get_enum_value(mode))
def set_correction_mode(
self, mode: CorrectionModeStr | QtWidgets.QSpinBox.CorrectionMode
):
"""Set correction mode.
Args:
mode: correction mode to use
"""
self.setCorrectionMode(CORRECTION_MODES.get_enum_value(mode))
def get_correction_mode(self) -> CorrectionModeStr:
"""Return correction mode.
Returns:
correction mode
"""
return CORRECTION_MODES.inverse[self.correctionMode()]
def set_step_type(
self: _NumericSpinBox, mode: StepTypeStr | QtWidgets.QSpinBox.StepType
):
"""Set step type.
Args:
mode: step type to use
"""
self.setStepType(STEP_TYPES.get_enum_value(mode))
def get_step_type(self: _NumericSpinBox) -> StepTypeStr:
"""Return step type.
Returns:
step type
"""
return STEP_TYPES.inverse[self.stepType()]
def set_special_value(self, value: str):
self.setSpecialValueText(value)
def get_value(self: _NumericSpinBox) -> float:
return self.value()
def set_value(self: _NumericSpinBox, value: float):
self.setValue(value) # ty: ignore[invalid-argument-type] # int for QSpinBox
|
Return button symbol type.
Source code in prettyqt/widgets/abstractspinbox.py
| def get_button_symbols(self) -> SymbolStr:
"""Return button symbol type.
Returns:
button symbol type
"""
return SYMBOLS.inverse[self.buttonSymbols()]
|
Return correction mode.
Source code in prettyqt/widgets/abstractspinbox.py
| def get_correction_mode(self) -> CorrectionModeStr:
"""Return correction mode.
Returns:
correction mode
"""
return CORRECTION_MODES.inverse[self.correctionMode()]
|
Return step type.
Source code in prettyqt/widgets/abstractspinbox.py
| def get_step_type(self: _NumericSpinBox) -> StepTypeStr:
"""Return step type.
Returns:
step type
"""
return STEP_TYPES.inverse[self.stepType()]
|
Set button symbol type.
Parameters:
| Name |
Type |
Description |
Default |
mode
|
SymbolStr | ButtonSymbols
|
button symbol type to use
|
required
|
Source code in prettyqt/widgets/abstractspinbox.py
| def set_button_symbols(self, mode: SymbolStr | QtWidgets.QSpinBox.ButtonSymbols):
"""Set button symbol type.
Args:
mode: button symbol type to use
"""
self.setButtonSymbols(SYMBOLS.get_enum_value(mode))
|
Set correction mode.
Parameters:
| Name |
Type |
Description |
Default |
mode
|
CorrectionModeStr | CorrectionMode
|
|
required
|
Source code in prettyqt/widgets/abstractspinbox.py
| def set_correction_mode(
self, mode: CorrectionModeStr | QtWidgets.QSpinBox.CorrectionMode
):
"""Set correction mode.
Args:
mode: correction mode to use
"""
self.setCorrectionMode(CORRECTION_MODES.get_enum_value(mode))
|
Set step type.
Parameters:
| Name |
Type |
Description |
Default |
mode
|
StepTypeStr | StepType
|
|
required
|
Source code in prettyqt/widgets/abstractspinbox.py
| def set_step_type(
self: _NumericSpinBox, mode: StepTypeStr | QtWidgets.QSpinBox.StepType
):
"""Set step type.
Args:
mode: step type to use
"""
self.setStepType(STEP_TYPES.get_enum_value(mode))
|
:fa-brands-github: Show source on GitHub