def flags(self, mi):
        """ Reimplemented to set editable status and movable status.
        """
        editor = self._editor
        row = mi.row()
        column = mi.column()

        if not mi.isValid():
            return QtCore.Qt.ItemIsDropEnabled

        flags = QtCore.Qt.ItemIsEnabled
        if editor.factory.selectable:
            flags |= QtCore.Qt.ItemIsSelectable

        # If the adapter defines get_can_edit_cell(), use it to determine
        # editability over the row-wise get_can_edit().
        if (editor.factory.editable and 'edit' in editor.factory.operations and
                hasattr(editor.adapter, 'get_can_edit_cell')):
            if editor.adapter.get_can_edit_cell(editor.object, editor.name,
                                                row, column):
                flags |= QtCore.Qt.ItemIsEditable
        elif (editor.factory.editable and 'edit' in editor.factory.operations and
                editor.adapter.get_can_edit(editor.object, editor.name, row)):
            flags |= QtCore.Qt.ItemIsEditable

        if editor.adapter.get_drag(editor.object, editor.name, row) is not None:
            flags |= QtCore.Qt.ItemIsDragEnabled

        if editor.factory.editable:
            flags |=  QtCore.Qt.ItemIsDropEnabled

        return flags
dataset/ETHPy150Open enthought/traitsui/traitsui/qt4/tabular_model.py/TabularModel.flags/original