17 lines
529 B
Python
17 lines
529 B
Python
'''自定义控件实现'''
|
|
from PyQt6.QtWidgets import QSpinBox, QDoubleSpinBox
|
|
from PyQt6.QtCore import Qt
|
|
|
|
class NoWheelSpinBox(QSpinBox):
|
|
"""禁用鼠标滚轮的SpinBox"""
|
|
def wheelEvent(self, event):
|
|
event.ignore()
|
|
|
|
class NoWheelDoubleSpinBox(QDoubleSpinBox):
|
|
"""禁用鼠标滚轮的DoubleSpinBox"""
|
|
def wheelEvent(self, event):
|
|
event.ignore()
|
|
|
|
def setDecimalsFromRules(self, decimals):
|
|
"""根据规则设置小数位数"""
|
|
self.setDecimals(decimals) |