mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-12-10 23:25:01 -05:00
Dynamically set range of spinbox for config value
This commit is contained in:
parent
cfba2cbdd5
commit
1b6465d2ac
@ -96,6 +96,7 @@ class ConfigWidget(QWidget):
|
|||||||
if opt.type == 'number':
|
if opt.type == 'number':
|
||||||
c = QSpinBox if isinstance(opt.default, numbers.Integral) else QDoubleSpinBox
|
c = QSpinBox if isinstance(opt.default, numbers.Integral) else QDoubleSpinBox
|
||||||
widget = c(self)
|
widget = c(self)
|
||||||
|
widget.setRange(min(widget.minimum(), 20 * val), max(widget.maximum(), 20 * val))
|
||||||
widget.setValue(val)
|
widget.setValue(val)
|
||||||
elif opt.type == 'string':
|
elif opt.type == 'string':
|
||||||
widget = QLineEdit(self)
|
widget = QLineEdit(self)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user