code: def setModel(self, model):
          
          super(StimulusView, self).setModel(model)
          self.setSelectionModel(ComponentSelectionModel(model))
          # initialize nested list to appropriate size
          self._rects = [[None] * self.model().columnCountForRow(x) for x in range(self.model().rowCount())]
  
          self._viewIsDirty = True
          self._calculateRects()
docs: Sets the model this view represents. :qtdoc:`Re-implemented<QAbstractItemView.setModel>`
  
          :param model: model to set
          :type model: :class:`QStimulusModel<sparkle.gui.stim.stimulus_model.QStimulusModel>`