Code Documentation 3.6
Social Network Visualizer
Loading...
Searching...
No Matches
graphtablewidget.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#include <QWidget>
16#include "../global.h" // SelectedEdge = QPair<int,int>
17
18class Graph;
19class NodeTableModel;
20class EdgeTableModel;
21class QAbstractItemModel;
22class QTabWidget;
23class QTableView;
24class QLineEdit;
25class QSortFilterProxyModel;
26
35class GraphTableWidget : public QWidget
36{
37 Q_OBJECT
38public:
39 explicit GraphTableWidget(QWidget *parent = nullptr);
40
42 QAbstractItemModel *nodeModel() const;
44 QAbstractItemModel *edgeModel() const;
45
50 void setNodeShapeLists(const QStringList &shapes, const QStringList &icons);
51
52public slots:
58 void refresh(Graph *graph);
59
66 void syncNodeSelection(const QList<int> &nodeNumbers);
67
73 void syncEdgeSelection(const QList<SocNetV::SelectedEdge> &edges);
74
76 void showNodesTab();
77
79 void showEdgesTab();
80
82 void exportNodesCSV();
84 void exportNodesJSON();
86 void exportEdgesCSV();
88 void exportEdgesJSON();
89
91 void importNodesCSV();
93 void importNodesJSON();
95 void importEdgesCSV();
97 void importEdgesJSON();
98
99signals:
101 void nodeSelected(int number);
102
104 void edgeSelected(int source, int target);
105
107 void exportStatusMessage(const QString &message);
108
110 void importStatusMessage(const QString &message);
111
112private slots:
113 void onNodeRowClicked(const QModelIndex &proxyIndex);
114 void onEdgeRowClicked(const QModelIndex &proxyIndex);
121
122private:
123 void doExport(QAbstractItemModel *proxyModel,
124 const QString &defaultName,
125 bool csv);
126 void doImport(bool forNodes, bool csv);
127
129 QList<int> resolveNodeTargets() const;
131 QList<SocNetV::SelectedEdge> resolveEdgeTargets() const;
132
133 Graph *m_graph = nullptr;
134 QTabWidget *m_tabs;
135 QTableView *m_nodeView;
136 QTableView *m_edgeView;
139 QSortFilterProxyModel *m_nodeProxy;
140 QSortFilterProxyModel *m_edgeProxy;
141 QLineEdit *m_nodeSearch;
142 QLineEdit *m_edgeSearch;
143 QStringList m_nodeShapeList;
144 QStringList m_iconPathList;
145};
Table model that caches edge data for the current relation from Graph and writes back via the Graph A...
Definition edgetablemodel.h:30
The Graph class This is the main class for a Graph, used in conjuction with GraphVertex,...
Definition graph.h:73
void syncEdgeSelection(const QList< SocNetV::SelectedEdge > &edges)
Highlights the rows in the Edges tab that match edges.
Definition graphtablewidget.cpp:482
GraphTableWidget(QWidget *parent=nullptr)
Constructs the GraphTableWidget.
Definition graphtablewidget.cpp:45
void onEdgeRowClicked(const QModelIndex &proxyIndex)
Maps the proxy index to source/target columns and emits edgeSelected().
Definition graphtablewidget.cpp:347
void importStatusMessage(const QString &message)
QStringList m_iconPathList
Definition graphtablewidget.h:144
void exportNodesJSON()
Definition graphtablewidget.cpp:374
QTableView * m_nodeView
Definition graphtablewidget.h:135
NodeTableModel * m_nodeModel
Definition graphtablewidget.h:137
QSortFilterProxyModel * m_edgeProxy
Definition graphtablewidget.h:140
Graph * m_graph
Definition graphtablewidget.h:133
QAbstractItemModel * edgeModel() const
Definition graphtablewidget.cpp:364
void setNodeShapeLists(const QStringList &shapes, const QStringList &icons)
Supplies the node shape list and icon paths so the bulk-edit dialog can offer Shape as a property opt...
Definition graphtablewidget.cpp:428
void doImport(bool forNodes, bool csv)
Opens DialogImportAttributes and, on acceptance, calls the appropriate Graph import method then refre...
Definition graphtablewidget.cpp:799
void onEdgeAddAttributeClicked()
Definition graphtablewidget.cpp:762
void importEdgesCSV()
Definition graphtablewidget.cpp:425
void onNodeAddAttributeClicked()
Definition graphtablewidget.cpp:653
void refresh(Graph *graph)
Repopulates both the node and edge models from graph.
Definition graphtablewidget.cpp:315
QLineEdit * m_edgeSearch
Definition graphtablewidget.h:142
QTableView * m_edgeView
Definition graphtablewidget.h:136
QSortFilterProxyModel * m_nodeProxy
Definition graphtablewidget.h:139
void onEdgeRemoveAttributeClicked()
Definition graphtablewidget.cpp:724
QList< SocNetV::SelectedEdge > resolveEdgeTargets() const
Returns (source, target) pairs for the table's current edge selection, or all visible proxy rows if n...
Definition graphtablewidget.cpp:546
QStringList m_nodeShapeList
Definition graphtablewidget.h:143
EdgeTableModel * m_edgeModel
Definition graphtablewidget.h:138
void showEdgesTab()
Definition graphtablewidget.cpp:436
void edgeSelected(int source, int target)
void doExport(QAbstractItemModel *proxyModel, const QString &defaultName, bool csv)
Opens a save dialog and writes proxyModel via TableExport.
Definition graphtablewidget.cpp:395
void onNodeSetPropertyClicked()
Definition graphtablewidget.cpp:571
void exportEdgesCSV()
Definition graphtablewidget.cpp:379
void exportStatusMessage(const QString &message)
QAbstractItemModel * nodeModel() const
Definition graphtablewidget.cpp:359
void exportNodesCSV()
Definition graphtablewidget.cpp:369
void onNodeRowClicked(const QModelIndex &proxyIndex)
Maps the proxy index to a source index and emits nodeSelected().
Definition graphtablewidget.cpp:333
QTabWidget * m_tabs
Definition graphtablewidget.h:134
void showNodesTab()
Definition graphtablewidget.cpp:435
void importNodesJSON()
Definition graphtablewidget.cpp:424
void onNodeRemoveAttributeClicked()
Definition graphtablewidget.cpp:617
void exportEdgesJSON()
Definition graphtablewidget.cpp:384
void onEdgeSetPropertyClicked()
Definition graphtablewidget.cpp:684
void importNodesCSV()
Definition graphtablewidget.cpp:423
QLineEdit * m_nodeSearch
Definition graphtablewidget.h:141
void nodeSelected(int number)
void importEdgesJSON()
Definition graphtablewidget.cpp:426
QList< int > resolveNodeTargets() const
Returns the node numbers for the table's current node selection, or for all visible proxy rows if not...
Definition graphtablewidget.cpp:520
void syncNodeSelection(const QList< int > &nodeNumbers)
Highlights the rows in the Nodes tab that match nodeNumbers.
Definition graphtablewidget.cpp:444
Table model that caches node data from Graph and writes back via the Graph API.
Definition nodetablemodel.h:30
Global definitions, constants, enumerations, and utility types for SocNetV.