Override Qt method

def data(self, index, role=Qt.DisplayRole):
        """Override Qt method"""
        if not index.isValid() or not 0 <= index.row() < len(self._rows):
            return to_qvariant()

        row = index.row()
        column = index.column()

        P = self._palette

        if self._rows[row] == row:
            action = C.ACTION_NONE
            type_ = u''
            name = u''
            description = u''
            version = u'-'
            status = -1
            # url = u''
            # license_ = u''
            i = False
            r = False
            u = False
            d = False
            # action_version = None
        else:
            action = self._rows[row][C.COL_ACTION]
            type_ = self._rows[row][C.COL_PACKAGE_TYPE]
            name = self._rows[row][C.COL_NAME]
            description = self._rows[row][C.COL_DESCRIPTION]
            version = self._rows[row][C.COL_VERSION]
            status = self._rows[row][C.COL_STATUS]
            # url = self._rows[row][C.COL_URL]
            # license_ = self._rows[row][C.COL_LICENSE]
            i = self._rows[row][C.COL_INSTALL]
            r = self._rows[row][C.COL_REMOVE]
            u = self._rows[row][C.COL_UPGRADE]
            d = self._rows[row][C.COL_DOWNGRADE]
            # action_version = self._rows[row][C.COL_ACTION_VERSION]

        is_upgradable = self.is_upgradable(self.index(row, C.COL_VERSION))
#        if is_upgradable:
#            version += C.UPGRADE_SYMBOL

        if role == Qt.DisplayRole:
            if column == C.COL_PACKAGE_TYPE:
                return to_qvariant(type_)
            if column == C.COL_NAME:
                return to_qvariant(name)
            elif column == C.COL_VERSION:
                return to_qvariant(version)
            elif column == C.COL_STATUS:
                return to_qvariant(status)
            elif column == C.COL_DESCRIPTION:
                return to_qvariant(description)
            elif column == C.COL_ACTION:
                return to_qvariant(action)
        elif role == Qt.BackgroundRole:
            if action == C.ACTION_REMOVE:
                return to_qvariant(P['background.remove'])
            elif action == C.ACTION_INSTALL:
                return to_qvariant(P['background.install'])
            elif action == C.ACTION_UPGRADE:
                return to_qvariant(P['background.upgrade'])
            elif action == C.ACTION_DOWNGRADE:
                return to_qvariant(P['background.downgrade'])
        elif role == Qt.TextAlignmentRole:
            if column in [C.COL_NAME, C.COL_DESCRIPTION]:
                return to_qvariant(int(Qt.AlignLeft | Qt.AlignVCenter))
            elif column in [C.COL_VERSION] and is_upgradable:
                return to_qvariant(int(Qt.AlignLeft | Qt.AlignVCenter))
            # else:
            #     return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter))
        elif role == Qt.DecorationRole:
            if column == C.COL_ACTION:
                if action == C.ACTION_NONE:
                    if status == C.NOT_INSTALLED:
                        return to_qvariant(P['icon.action.not_installed'])
                    elif status in [C.UPGRADABLE, C.MIXGRADABLE]:
                        return to_qvariant(P['icon.action.installed'])
                    elif status in [C.INSTALLED, C.DOWNGRADABLE,
                                    C.MIXGRADABLE]:
                        return to_qvariant(P['icon.action.installed'])
                elif action == C.ACTION_INSTALL:
                    return to_qvariant(P['icon.action.add'])
                elif action == C.ACTION_REMOVE:
                    return to_qvariant(P['icon.action.remove'])
                elif action == C.ACTION_UPGRADE:
                    return to_qvariant(P['icon.action.upgrade'])
                elif action == C.ACTION_DOWNGRADE:
                    return to_qvariant(P['icon.action.downgrade'])
                else:
                    return to_qvariant()
            elif column == C.COL_PACKAGE_TYPE:
                if type_ == C.CONDA_PACKAGE:
                    return to_qvariant(P['icon.anaconda'])
                elif type_ == C.PIP_PACKAGE:
                    return to_qvariant(P['icon.python'])
                else:
                    return to_qvariant()
            elif column == C.COL_INSTALL:
                if status == C.NOT_INSTALLED:
                    if i:
                        return to_qvariant(P['icon.add.pressed'])
                    else:
                        return to_qvariant(P['icon.add.active'])
                elif (status == C.INSTALLED or
                      status == C.UPGRADABLE or
                      status == C.DOWNGRADABLE or
                      status == C.MIXGRADABLE):
                    if r:
                        return to_qvariant(P['icon.remove.pressed'])
                    else:
                        return to_qvariant(P['icon.remove.active'])
                else:
                    return to_qvariant(P['icon.add.inactive'])
            elif column == C.COL_REMOVE:
                if (status == C.INSTALLED or
                    status == C.UPGRADABLE or
                    status == C.DOWNGRADABLE or
                   status == C.MIXGRADABLE):
                    if r:
                        return to_qvariant(P['icon.remove.pressed'])
                    else:
                        return to_qvariant(P['icon.remove.active'])
                else:
                    return to_qvariant(P['icon.remove.inactive'])
            elif column == C.COL_UPGRADE:
                if status == C.UPGRADABLE or \
                  status == C.MIXGRADABLE:
                    if u:
                        return to_qvariant(P['icon.upgrade.pressed'])
                    else:
                        return to_qvariant(P['icon.upgrade.active'])
                else:
                    return to_qvariant(P['icon.upgrade.inactive'])
            elif column == C.COL_DOWNGRADE:
                if status == C.DOWNGRADABLE or \
                  status == C.MIXGRADABLE:
                    if d:
                        return to_qvariant(P['icon.downgrade.pressed'])
                    else:
                        return to_qvariant(P['icon.downgrade.active'])
                else:
                    return to_qvariant(P['icon.downgrade.inactive'])
            elif column == C.COL_VERSION:
                if is_upgradable:
                    return to_qvariant(P['icon.upgrade.arrow'])
                else:
                    return to_qvariant(P['spacer'])
        elif role == Qt.ToolTipRole:
            if column == C.COL_INSTALL and status == C.NOT_INSTALLED:
                return to_qvariant(_('Install package'))
            elif column == C.COL_INSTALL and (status == C.INSTALLED or
                                              status == C.UPGRADABLE or
                                              status == C.DOWNGRADABLE or
                                              status == C.MIXGRADABLE):
                return to_qvariant(_('Remove package'))
            elif column == C.COL_UPGRADE and (status == C.INSTALLED or
                                              status == C.UPGRADABLE or
                                              status == C.MIXGRADABLE):
                return to_qvariant(_('Upgrade package'))
            elif column == C.COL_DOWNGRADE and (status == C.INSTALLED or
                                                status == C.DOWNGRADABLE or
                                                status == C.MIXGRADABLE):
                return to_qvariant(_('Downgrade package'))
            elif column == C.COL_PACKAGE_TYPE:
                if type_ == C.CONDA_PACKAGE:
                    return to_qvariant(_('Conda package'))
                elif type_ == C.PIP_PACKAGE:
                    return to_qvariant(_('Python package'))
            elif column == C.COL_VERSION:
                if is_upgradable:
                    return to_qvariant(_('Update available'))
        elif role == Qt.ForegroundRole:
            palette = QPalette()
            if column in [C.COL_NAME, C.COL_DESCRIPTION]:
                if status in [C.INSTALLED, C.UPGRADABLE, C.DOWNGRADABLE,
                              C.MIXGRADABLE]:
                    color = palette.color(QPalette.WindowText)
                    return to_qvariant(color)
                elif status in [C.NOT_INSTALLED]:
                    color = palette.color(QPalette.Mid)
                    color = P['foreground.not.installed']
                    return to_qvariant(color)
            elif column in [C.COL_VERSION]:
                if is_upgradable:
                    return to_qvariant(P['foreground.upgrade'])

        elif role == Qt.SizeHintRole:
            if column in [C.ACTION_COLUMNS] + [C.COL_PACKAGE_TYPE]:
                return to_qvariant(QSize(24, 24))

        return to_qvariant()