aboutsummaryrefslogtreecommitdiff
path: root/gui/widgets/spinbox.py
blob: 1abb63a993146c6abf1b31397df26bdddf9e339a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from PyQt5.QtWidgets import QSpinBox


class SpinBox(QSpinBox):
    def __init__(self):
        super(QSpinBox, self).__init__()
        self.setMaximum(2**31 - 1)
        self.setMinimum(-self.maximum())

    def get_value(self, ql_type):
        return ql_type(self.value())

    def on_change(self, change_event_function):
        self.valueChanged.connect(lambda: change_event_function(self))