Reimplements the :meth:`QAbstractItemModel.data` method.

        :param index: Index.
        :type index: QModelIndex
        :param role: Role.
        :type role: int
        :return: Data.
        :rtype: QVariant

def data(self, index, role=Qt.DisplayRole):
        """
        Reimplements the :meth:`QAbstractItemModel.data` method.

        :param index: Index.
        :type index: QModelIndex
        :param role: Role.
        :type role: int
        :return: Data.
        :rtype: QVariant
        """

        if not index.isValid():
            return QVariant()

        node = self.get_node(index)
        if index.column() == 0:
            if hasattr(node, "roles"):
                if role == Qt.DecorationRole:
                    return QIcon(node.roles.get(role, ""))
                else:
                    return node.roles.get(role, QVariant())
        else:
            attribute = self.get_attribute(node, index.column())
            if attribute:
                if hasattr(attribute, "roles"):
                    if role == Qt.DecorationRole:
                        return QIcon(attribute.roles.get(role, ""))
                    else:
                        return attribute.roles.get(role, QVariant())
        return QVariant()