コード例 #1
0
ファイル: fatture.py プロジェクト: L0cutus/Gestione-Fatture
 def setModelData(self, editor, model, index):
     if index.column() == SIVA:
         model.setData(index, QVariant(editor.text().replace(',', '.')))
     elif index.column() == SIMP:
         model.setData(index, QVariant(editor.text().replace(',', '.')))
     else:
         QSqlRelationalDelegate.setModelData(self, editor, model, index)
コード例 #2
0
 def setModelData(self, editor, model, index):
     if index.column() == DATAINS:
         model.setData(index, QVariant(editor.date()))
         self.lastData = editor.date()
     elif index.column() == IMP:
         model.setData(index, QVariant(editor.text().replace(',', '.')))
     else:
         QSqlRelationalDelegate.setModelData(self, editor, model, index)
コード例 #3
0
 def setEditorData(self, editor, index):
     if index.column() == DATAINS:
         editor.setDisplayFormat(DATEFORMAT)
         if not self.lastData:
             self.lastData = QDate.currentDate()
         editor.setDate(self.lastData)
     else:
         QSqlRelationalDelegate.setEditorData(self, editor, index)
コード例 #4
0
ファイル: clienti.py プロジェクト: L0cutus/Gestione-Clienti
 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)
コード例 #5
0
ファイル: ddt.py プロジェクト: L0cutus/Gestione-DDT
    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)
コード例 #6
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)