Exemple #1
0
 def setEditorData(self, editor, index):
     val = index.data(Qt.ItemDataRole.EditRole)
     if check_key_modifier(Qt.KeyboardModifier.ControlModifier):
         val = UNDEFINED_QDATETIME
     elif check_key_modifier(Qt.KeyboardModifier.ShiftModifier + Qt.KeyboardModifier.ControlModifier):
         val = now()
     elif is_date_undefined(val):
         val = QDate.currentDate()
     if isinstance(val, QDateTime):
         val = val.date()
     editor.setDate(val)
Exemple #2
0
 def showEvent(self, ev):
     if self.selectedDate().year() == UNDEFINED_DATE.year:
         self.setSelectedDate(QDate.currentDate())