Esempio n. 1
0
 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)
Esempio n. 2
0
    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() == SIMP:
            editor = MyQLineEdit(parent)
            validator = QDoubleValidator(self)
            validator.setDecimals(3)
            editor.setValidator(validator)
            editor.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
            self.connect(editor, SIGNAL("keyDownPressEvent()"),
                        self.gestEvt)
            return editor
        elif index.column() == SIVA:
            editor = MyQLineEdit(parent)
            validator = QDoubleValidator(self)
            validator.setDecimals(3)
            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

        editor = QSqlRelationalDelegate.createEditor(self, parent,
                                                    option, index)
        return editor