def createEditor(self, parent, option, index): if index.column() == CPIVA: editor = QLineEdit(parent) validator = QRegExpValidator(QRegExp(r"\d{11}"), self) editor.setValidator(validator) editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter) return editor else: return QSqlRelationalDelegate.createEditor(self, parent, option, index)
def createEditor(self, parent, option, index): if index.column() == SQT: editor = MyQLineEdit(parent) validator = QIntValidator(self) editor.setValidator(validator) editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter) self.connect(editor, SIGNAL("keyDownPressEvent()"), self.gestEvt) return editor elif index.column() == SDESC: editor = MyQLineEdit(parent) editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter) self.connect(editor, SIGNAL("keyDownPressEvent()"), self.gestEvt) return editor return QSqlRelationalDelegate.createEditor(self, parent, option, index)
def createEditor(self, parent, option, index): if index.column() == DATAINS: editor = QDateEdit(parent) editor.setCalendarPopup(True) editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter) return editor elif index.column() == QT: editor = QLineEdit(parent) validator = QIntValidator(self) editor.setValidator(validator) editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter) return editor elif index.column() == IMP: editor = QLineEdit(parent) validator = QDoubleValidator(self) validator.setDecimals(3) editor.setValidator(validator) editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter) return editor else: return QSqlRelationalDelegate.createEditor(self, parent, option, index)