def createEditor(self, aParent, option, index): delegate = self.getDelegate(index) if delegate: return delegate.createEditor(aParent, option, index) else: return QSqlRelationalDelegate.createEditor(self, aParent, option, index)
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