code: def updateEditorGeometry(self, editor, option, index):
          
          super(WidgetDelegate, self).updateEditorGeometry(editor, option, index)
          editor.setGeometry(option.rect)
          if self.keep_editor_size:
              esh = editor.sizeHint()
              osh = option.rect.size()
              w = osh.width() if osh.width() > esh.width() else esh.width()
              h = osh.height() if osh.height() > esh.height() else esh.height()
              editor.resize(w, h)
docs: Make sure the editor is the same size as the widget
  
          By default it can get smaller because does not expand over viewport size.
          This will make sure it will resize to the same size as the widget.
  
          :param editor: the editor to update
          :type editor: :class:`QtGui.QWidget`
          :param option: the options for painting
          :type option: QtGui.QStyleOptionViewItem
          :param index: the index to paint
          :type index: QtCore.QModelIndex
          :returns: None
          :rtype: None
          :raises: None