Coverage for openhcs/pyqt_gui/widgets/shared/no_scroll_spinbox.py: 0.0%

11 statements  

« prev     ^ index     » next       coverage.py v7.10.3, created at 2025-08-14 05:57 +0000

1""" 

2No-scroll spinbox widgets for PyQt6. 

3 

4Prevents accidental value changes from mouse wheel events. 

5""" 

6 

7from PyQt6.QtWidgets import QSpinBox, QDoubleSpinBox, QComboBox 

8from PyQt6.QtGui import QWheelEvent 

9 

10 

11class NoScrollSpinBox(QSpinBox): 

12 """SpinBox that ignores wheel events to prevent accidental value changes.""" 

13 

14 def wheelEvent(self, event: QWheelEvent): 

15 """Ignore wheel events to prevent accidental value changes.""" 

16 event.ignore() 

17 

18 

19class NoScrollDoubleSpinBox(QDoubleSpinBox): 

20 """DoubleSpinBox that ignores wheel events to prevent accidental value changes.""" 

21 

22 def wheelEvent(self, event: QWheelEvent): 

23 """Ignore wheel events to prevent accidental value changes.""" 

24 event.ignore() 

25 

26 

27class NoScrollComboBox(QComboBox): 

28 """ComboBox that ignores wheel events to prevent accidental value changes.""" 

29 

30 def wheelEvent(self, event: QWheelEvent): 

31 """Ignore wheel events to prevent accidental value changes.""" 

32 event.ignore()