Ejemplo n.º 1
0
 def createEditor(self,parent,option,index):
     """create widgets to edit values"""
     if index.isValid():
         model = index.model()
         column = index.column()
         if (column == model.position_for_header('date')) or \
            (column == model.position_for_header('expected_date')) :
                 data = model.data(index,Qt.DisplayRole)
                 if data.toString() == "":
                     data = datetime.today()
                 editor = QDateTimeEdit(data)
                 editor.setCalendarPopup(True)                    
                 self.updateEditorGeometry(editor, option,index )
                 # by default it's a bit too small
                 editor.setFixedWidth(option.rect.width() + 50)
                 # FIXME: resulting position is still wrong
                 return editor
                 
     return QStyledItemDelegate.createEditor(self,parent,option,index)