title: Adding items to a QTableView within QCalendarWidget
body: <p>I'm currently making a to-do application which has a calendar. Whenever the user has an event on a specific date, A red circle appears in the top left corner. Whenever the user double clicks on the date, I want it to display a new window with information on event for the day. However, I am having trouble storing information into each date. How can I make it so each date has a sort of list that can store events?</p>
  
  <p>Here is the UI:</p>
  
  <p><a href="https://i.stack.imgur.com/Zc0ln.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zc0ln.png" alt="enter image description here"></a> </p>
  
  <p>Here is the code for the subclassed QCalendarWidget:</p>
  
  <pre><code>class TodoCalendar(QtWidgets.QCalendarWidget):
      def __init__(self, list_of_events, *args, **kwargs):
          super().__init__(*args, **kwargs)
          self.list_of_events = list_of_events
          //list_of_events is a list of all events the user has created
  
          self.table = self.findChild(QtWidgets.QTableView)
          self.table.viewport().installEventFilter(self)
  
      def paintCell(self, painter, rect, date):
          super().paintCell(painter, rect, date)
          for event in self.list_of_events.values():
              if event.due_time == date:
                  painter.setBrush(Qt.red)
                  painter.drawEllipse(rect.topLeft() + QPoint(12, 7), 3, 3)
  
      def eventFilter(self, source, event):
          if (event.type() == QtCore.QEvent.MouseButtonDblClick and source is self.table.viewport()):
              index = self.table.indexAt(event.pos())
              print(f"row: {index.row()}, column: {index.column()}, text: {index.data()}")
          return super().eventFilter(source, event)
  </code></pre>
  
  <p>Also here is the list for list_of_events:</p>
  
  <pre><code>{'test changed': &lt;CustomWidgets.TodoEvent object at 0x00000230A5A72908&gt;, 'due 10/8': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AA5080&gt;, 'also due 10/9': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AC4B00&gt;, 'also due 10/9 too': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD0550&gt;, 'due 10/9 too too': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD0A90&gt;, '10/9 2': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD6438&gt;, '10/10': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD64A8&gt;, '10/10 also': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD64E0&gt;, '10/10 2': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD6550&gt;, '10/10 3': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD65C0&gt;, '10/10 4': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD6630&gt;, 'due 10/9 changed': &lt;CustomWidgets.TodoEvent object at 0x00000230A5AD6668&gt;}
  </code></pre>
  
  <p>each toDoEvent has a title, due_time, remind_time, and description</p>