#pragma once #include #include #include #include #include #include #include #include "global.h" /** * The central class in the Model-View approach. It delivers all kinds * of information from the backing user data structures that represent * the graph. The class allows to modify the graph structure: create * and remove nodes and connections. * * We use two types of the unique ids for graph manipulations: * - NodeId * - ConnectionId */ class BaseModel : public QObject { Q_OBJECT /// @brief Returns node-related data for requested NodeRole. /** * @returns Node Caption, Node Caption Visibility, Node Position etc. */ virtual QVariant nodeData(QUuid nodeId, NodeRole role) const = 0; /** * A utility function that unwraps the `QVariant` value returned from the * standard `QVariant AbstractGraphModel::nodeData(NodeId, NodeRole)` function. */ template T nodeData(QUuid nodeId, NodeRole role) const { return nodeData(nodeId, role).value(); } virtual NodeFlags nodeFlags(NodeId nodeId) const { Q_UNUSED(nodeId); return NodeFlag::NoFlags; } };