![]() |
Code Documentation 3.5
Social Network Visualizer
|
Free functions that serialise any QAbstractItemModel to CSV or JSON. More...
Functions | |
| static QString | csvQuote (const QString &value) |
| bool | toCSV (QAbstractItemModel *model, const QString &filePath) |
Writes model to an RFC 4180 CSV file at filePath. | |
| bool | toJSON (QAbstractItemModel *model, const QString &filePath) |
Writes model to a JSON file at filePath. | |
Free functions that serialise any QAbstractItemModel to CSV or JSON.
Both functions operate on whatever rows and columns the model exposes — pass a QSortFilterProxyModel to export only the currently visible rows, or the raw source model to export everything.
Constraint: QtCore only — no widgets, no UI signals.
|
static |
| bool TableExport::toCSV | ( | QAbstractItemModel * | model, |
| const QString & | filePath | ||
| ) |
Writes model to an RFC 4180 CSV file at filePath.
The first row is the column headers from headerData(). Each subsequent row is one model row. Fields containing commas, double-quotes, or newlines are enclosed in double-quotes; embedded double-quotes are escaped as "".
| bool TableExport::toJSON | ( | QAbstractItemModel * | model, |
| const QString & | filePath | ||
| ) |
Writes model to a JSON file at filePath.
Produces a top-level JSON array of objects. Each object has one key per column, taken from headerData(), with the display-role cell value as the string value.