Code Documentation 3.6
Social Network Visualizer
Loading...
Searching...
No Matches
NodeTableModel Class Reference

Table model that caches node data from Graph and writes back via the Graph API. More...

#include <widgets/nodetablemodel.h>

Inheritance diagram for NodeTableModel:
Collaboration diagram for NodeTableModel:

Classes

struct  NodeRow

Public Member Functions

 NodeTableModel (QObject *parent=nullptr)
void populate (Graph *graph)
 Rebuilds the internal cache from graph.
QStringList attrKeys () const
int rowCount (const QModelIndex &parent=QModelIndex()) const override
int columnCount (const QModelIndex &parent=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Qt::ItemFlags flags (const QModelIndex &index) const override
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override

Private Attributes

Graphm_graph = nullptr
QList< NodeRowm_rows
QStringList m_attrKeys

Static Private Attributes

static constexpr int FIXED_COLS = 6
static constexpr int COL_NUMBER = 0
static constexpr int COL_LABEL = 1
static constexpr int COL_VISIBLE = 2
static constexpr int COL_SHAPE = 3
static constexpr int COL_SIZE = 4
static constexpr int COL_COLOR = 5

Detailed Description

Table model that caches node data from Graph and writes back via the Graph API.

Fixed columns: #, Label, Visible, Shape, Size, Color. Dynamic columns: one per custom attribute key reported by the graph.

Constructor & Destructor Documentation

◆ NodeTableModel()

NodeTableModel::NodeTableModel ( QObject * parent = nullptr)
explicit

Member Function Documentation

◆ attrKeys()

QStringList NodeTableModel::attrKeys ( ) const
inline

Custom attribute keys present in the current graph (dynamic columns).

◆ columnCount()

int NodeTableModel::columnCount ( const QModelIndex & parent = QModelIndex()) const
override

◆ data()

QVariant NodeTableModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
override

◆ flags()

Qt::ItemFlags NodeTableModel::flags ( const QModelIndex & index) const
override

◆ headerData()

QVariant NodeTableModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
override

◆ populate()

void NodeTableModel::populate ( Graph * graph)

Rebuilds the internal cache from graph.

Rebuilds the internal row cache from graph.

Calls beginResetModel() / endResetModel() so connected views repaint.

All vertices (enabled and disabled) are included; the Visible column reflects the vertex's enabled state. Custom attribute keys are taken from Graph::graphHasVertexCustomAttributes().

◆ rowCount()

int NodeTableModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
override

◆ setData()

bool NodeTableModel::setData ( const QModelIndex & index,
const QVariant & value,
int role = Qt::EditRole )
override

Member Data Documentation

◆ COL_COLOR

int NodeTableModel::COL_COLOR = 5
staticconstexprprivate

◆ COL_LABEL

int NodeTableModel::COL_LABEL = 1
staticconstexprprivate

◆ COL_NUMBER

int NodeTableModel::COL_NUMBER = 0
staticconstexprprivate

◆ COL_SHAPE

int NodeTableModel::COL_SHAPE = 3
staticconstexprprivate

◆ COL_SIZE

int NodeTableModel::COL_SIZE = 4
staticconstexprprivate

◆ COL_VISIBLE

int NodeTableModel::COL_VISIBLE = 2
staticconstexprprivate

◆ FIXED_COLS

int NodeTableModel::FIXED_COLS = 6
staticconstexprprivate

◆ m_attrKeys

QStringList NodeTableModel::m_attrKeys
private

◆ m_graph

Graph* NodeTableModel::m_graph = nullptr
private

◆ m_rows

QList<NodeRow> NodeTableModel::m_rows
private

The documentation for this class was generated from the following files: