예제 #1
0
    def createEditor(self, parent, option, index):
        if index.column() != 4:
            return QSqlRelationalDelegate.createEditor(self, parent, option, index)

        # For editing the year, return a spinbox with a range from -1000 to 2100.
        spinbox = QSpinBox(parent)
        spinbox.setFrame(False)
        spinbox.setMaximum(2100)
        spinbox.setMinimum(-1000)
        return spinbox
예제 #2
0
 def createEditor(
     self,
     parent: QWidget,
     option: QStyleOptionViewItem,
     index: QModelIndex,
 ) -> PySide2.QtWidgets.QWidget:
     editor = QSpinBox(parent)
     editor.setFrame(False)
     editor.setMinimum(self.min)
     editor.setMaximum(self.max)
     return editor
예제 #3
0
    def createEditor(self, parent):
        """
        Creates a QSpinBox instance for GUI editing of integer values

        :param parent: the parent of the widget
        :return: a QSpinBox instance
        """
        res = QSpinBox(parent)
        res.setFrame(False)
        if "min" in self._options:
            res.setMinimum(self._options["min"])
        else:
            res.setMinimum(-2147483648)
        if "max" in self._options:
            res.setMaximum(self._options["max"])
        else:
            res.setMaximum(2147483647)
        return res
예제 #4
0
class SequenceRecordItem:
    def __init__(self, parent, seq_record, font):
        self.seq_record = seq_record
        self.parent = parent

        self.selectButton = QToolButton(parent)

        self.nameLabel = QLabel(parent)
        self.nameLabel.setFrameShape(QFrame.Box)
        self.nameLabel.setText(str(self.seq_record.name))

        self.shiftLeftButton = QToolButton(parent)
        self.shiftLeftButton.setArrowType(Qt.LeftArrow)
        self.shiftRightButton = QToolButton(parent)
        self.shiftRightButton.setArrowType(Qt.RightArrow)

        self.shiftSpinBox = QSpinBox(parent)
        self.shiftSpinBox.setFrame(True)
        self.shiftSpinBox.setButtonSymbols(QSpinBox.NoButtons)
        self.shiftSpinBox.setMinimum(-999999)
        self.shiftSpinBox.setMaximum(999999)
        self.shiftSpinBox.setValue(0)

        self.seqLabel = SequenceRecordLabel(parent, font)

        self.widgets = [
            self.selectButton, self.nameLabel, self.shiftLeftButton,
            self.shiftRightButton, self.shiftSpinBox, self.seqLabel
        ]

        self.shiftRightButton.clicked.connect(self.shiftSpinBox.stepUp)
        self.shiftLeftButton.clicked.connect(self.shiftSpinBox.stepDown)

    selected = False
    shift = 0

    seq_select_beginning = 0
    seq_select_end = 0