Code Documentation 3.5
Social Network Visualizer
Loading...
Searching...
No Matches
GraphTableWidget Class Reference

A QWidget containing a QTabWidget with two tabs — Nodes and Edges — each backed by a sortable, searchable table view. More...

#include <widgets/graphtablewidget.h>

Inheritance diagram for GraphTableWidget:
Collaboration diagram for GraphTableWidget:

Public Slots

void refresh (Graph *graph)
 Repopulates both the node and edge models from graph.
 
void exportNodesCSV ()
 
void exportNodesJSON ()
 
void exportEdgesCSV ()
 
void exportEdgesJSON ()
 
void importNodesCSV ()
 
void importNodesJSON ()
 
void importEdgesCSV ()
 
void importEdgesJSON ()
 

Signals

void nodeSelected (int number)
 
void exportStatusMessage (const QString &message)
 
void importStatusMessage (const QString &message)
 

Public Member Functions

 GraphTableWidget (QWidget *parent=nullptr)
 Constructs the GraphTableWidget.
 
QAbstractItemModel * nodeModel () const
 
QAbstractItemModel * edgeModel () const
 

Private Slots

void onNodeRowClicked (const QModelIndex &proxyIndex)
 Maps the proxy index to a source index and emits nodeSelected().
 

Private Member Functions

void doExport (QAbstractItemModel *proxyModel, const QString &defaultName, bool csv)
 Opens a save dialog and writes proxyModel via TableExport.
 
void doImport (bool forNodes, bool csv)
 Opens DialogImportAttributes and, on acceptance, calls the appropriate Graph import method then refreshes the table.
 

Private Attributes

Graphm_graph = nullptr
 
QTabWidget * m_tabs
 
QTableView * m_nodeView
 
QTableView * m_edgeView
 
NodeTableModelm_nodeModel
 
EdgeTableModelm_edgeModel
 
QSortFilterProxyModel * m_nodeProxy
 
QSortFilterProxyModel * m_edgeProxy
 
QLineEdit * m_nodeSearch
 
QLineEdit * m_edgeSearch
 

Detailed Description

A QWidget containing a QTabWidget with two tabs — Nodes and Edges — each backed by a sortable, searchable table view.

Call refresh() whenever the graph data changes and the panel is visible. The widget itself does not auto-refresh; the caller controls when to rebuild the cache.

Constructor & Destructor Documentation

◆ GraphTableWidget()

GraphTableWidget::GraphTableWidget ( QWidget *  parent = nullptr)
explicit

Constructs the GraphTableWidget.

Builds both tabs (Nodes, Edges) with search bar, Refresh button, and a sortable/searchable QTableView backed by a QSortFilterProxyModel.

Member Function Documentation

◆ doExport()

void GraphTableWidget::doExport ( QAbstractItemModel *  proxyModel,
const QString &  defaultName,
bool  csv 
)
private

Opens a save dialog and writes proxyModel via TableExport.

defaultName is used to suggest a filename ("nodes" or "edges"). csv selects CSV (true) or JSON (false) format.

◆ doImport()

void GraphTableWidget::doImport ( bool  forNodes,
bool  csv 
)
private

Opens DialogImportAttributes and, on acceptance, calls the appropriate Graph import method then refreshes the table.

forNodes true → import node attributes; false → import edge attributes. csv true → CSV format; false → JSON format.

◆ edgeModel()

QAbstractItemModel * GraphTableWidget::edgeModel ( ) const

Returns the raw (unfiltered) edge source model.

◆ exportEdgesCSV

void GraphTableWidget::exportEdgesCSV ( )
slot

Prompts for a file path and exports visible edge rows as CSV.

◆ exportEdgesJSON

void GraphTableWidget::exportEdgesJSON ( )
slot

Prompts for a file path and exports visible edge rows as JSON.

◆ exportNodesCSV

void GraphTableWidget::exportNodesCSV ( )
slot

Prompts for a file path and exports visible node rows as CSV.

◆ exportNodesJSON

void GraphTableWidget::exportNodesJSON ( )
slot

Prompts for a file path and exports visible node rows as JSON.

◆ exportStatusMessage

void GraphTableWidget::exportStatusMessage ( const QString &  message)
signal

Emitted with a status message after an export attempt.

◆ importEdgesCSV

void GraphTableWidget::importEdgesCSV ( )
slot

Opens the column-mapping dialog and imports edge attributes from a CSV.

◆ importEdgesJSON

void GraphTableWidget::importEdgesJSON ( )
slot

Opens the column-mapping dialog and imports edge attributes from a JSON.

◆ importNodesCSV

void GraphTableWidget::importNodesCSV ( )
slot

Opens the column-mapping dialog and imports node attributes from a CSV.

◆ importNodesJSON

void GraphTableWidget::importNodesJSON ( )
slot

Opens the column-mapping dialog and imports node attributes from a JSON.

◆ importStatusMessage

void GraphTableWidget::importStatusMessage ( const QString &  message)
signal

Emitted with a status message after an import attempt.

◆ nodeModel()

QAbstractItemModel * GraphTableWidget::nodeModel ( ) const

Returns the raw (unfiltered) node source model.

◆ nodeSelected

void GraphTableWidget::nodeSelected ( int  number)
signal

Emitted when the user clicks a row in the Nodes tab.

◆ onNodeRowClicked

void GraphTableWidget::onNodeRowClicked ( const QModelIndex &  proxyIndex)
privateslot

Maps the proxy index to a source index and emits nodeSelected().

◆ refresh

void GraphTableWidget::refresh ( Graph graph)
slot

Repopulates both the node and edge models from graph.

Repopulates both models from graph and resizes columns.

Stores a pointer to graph for subsequent Refresh button clicks.

Member Data Documentation

◆ m_edgeModel

EdgeTableModel* GraphTableWidget::m_edgeModel
private

◆ m_edgeProxy

QSortFilterProxyModel* GraphTableWidget::m_edgeProxy
private

◆ m_edgeSearch

QLineEdit* GraphTableWidget::m_edgeSearch
private

◆ m_edgeView

QTableView* GraphTableWidget::m_edgeView
private

◆ m_graph

Graph* GraphTableWidget::m_graph = nullptr
private

◆ m_nodeModel

NodeTableModel* GraphTableWidget::m_nodeModel
private

◆ m_nodeProxy

QSortFilterProxyModel* GraphTableWidget::m_nodeProxy
private

◆ m_nodeSearch

QLineEdit* GraphTableWidget::m_nodeSearch
private

◆ m_nodeView

QTableView* GraphTableWidget::m_nodeView
private

◆ m_tabs

QTabWidget* GraphTableWidget::m_tabs
private

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