pyqt_reactive.widgets.no_scroll_spinbox

No-scroll spinbox widgets for PyQt6.

Prevents accidental value changes from mouse wheel events.

Classes

CheckboxValueState(*values)

Value ownership state for None-aware checkboxes.

NoScrollComboBox([parent, placeholder])

ComboBox that ignores wheel events to prevent accidental value changes.

NoScrollDoubleSpinBox([parent])

DoubleSpinBox that ignores wheel events to prevent accidental value changes.

NoScrollSpinBox([parent])

SpinBox that ignores wheel events to prevent accidental value changes.

NoneAwareCheckBox([parent])

QCheckBox that supports None state for lazy dataclass contexts.

class pyqt_reactive.widgets.no_scroll_spinbox.NoScrollSpinBox(parent=None)[source]

SpinBox that ignores wheel events to prevent accidental value changes.

Inherits from SpinBoxAdapter which already implements ValueGettable/ValueSettable ABCs.

wheelEvent(event: QWheelEvent)[source]

Ignore wheel events to prevent accidental value changes.

class pyqt_reactive.widgets.no_scroll_spinbox.NoScrollDoubleSpinBox(parent=None)[source]

DoubleSpinBox that ignores wheel events to prevent accidental value changes.

Inherits from DoubleSpinBoxAdapter which already implements ValueGettable/ValueSettable ABCs.

wheelEvent(event: QWheelEvent)[source]

Ignore wheel events to prevent accidental value changes.

textFromValue(value: float) str[source]

Convert value to string without trailing zeros for clean display.

Users can still type additional digits when editing - this only affects the display format, not the underlying precision.

Examples

1.5 -> “1.5” 1.0 -> “1” 1.567 -> “1.567” 0.0001 -> “0.0001”

class pyqt_reactive.widgets.no_scroll_spinbox.NoScrollComboBox(parent=None, placeholder='')[source]

ComboBox that ignores wheel events to prevent accidental value changes.

Inherits from ComboBoxAdapter which already implements ValueGettable/ValueSettable ABCs. Supports placeholder text when currentIndex == -1 (for None values).

__init__(parent=None, placeholder='')[source]
wheelEvent(event: QWheelEvent)[source]

Ignore wheel events to prevent accidental value changes.

setPlaceholder(text: str)[source]

Set the placeholder text shown when currentIndex == -1.

setCurrentIndex(index: int)[source]

Override to track when placeholder should be active.

get_value()[source]

Get current value (item data at current index).

set_value(value)[source]

Set current value by finding matching item data.

paintEvent(event)[source]

Override to draw placeholder text when currentIndex == -1.

class pyqt_reactive.widgets.no_scroll_spinbox.CheckboxValueState(*values)[source]

Value ownership state for None-aware checkboxes.

PLACEHOLDER = 'placeholder'
CONCRETE = 'concrete'
class pyqt_reactive.widgets.no_scroll_spinbox.NoneAwareCheckBox(parent=None)[source]

QCheckBox that supports None state for lazy dataclass contexts.

Shows inherited value as grayed placeholder when value is None. Clicking converts placeholder to explicit value.

__init__(parent=None)[source]
get_value()[source]

Get value, returning None if in placeholder state.

is_placeholder() bool[source]

Return whether the checkbox is currently displaying inherited state.

set_value(value)[source]

Set value, handling None by leaving in placeholder state.

set_placeholder_preview(checked: bool) None[source]

Display an inherited checkbox value without making it concrete.

convert_placeholder_to_concrete() None[source]

Keep the displayed value but mark it as a user-controlled value.

clear_placeholder_cache() None[source]

Clear cached placeholder text set by the placeholder enhancer.

mousePressEvent(event)[source]

On click, switch from placeholder to explicit value.

paintEvent(event)[source]

Draw with placeholder styling.

For placeholder state, draw the checkbox with grey text color to make the checkmark appear dimmed.