Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
CSVModelWriter Class Reference

Export a Qt table model to a CSV file. More...

#include <csvmodelwriter.h>

Inheritance diagram for CSVModelWriter:
[legend]
Collaboration diagram for CSVModelWriter:
[legend]

Classes

struct  Column

Public Member Functions

 CSVModelWriter (const QString &filename, QObject *parent=nullptr)
void setModel (const QAbstractItemModel *model)
void addColumn (const QString &title, int column, int role=Qt::EditRole)
bool write ()
 Perform export of the model to CSV.

Private Attributes

QString filename
const QAbstractItemModel * model {nullptr}
QList< Columncolumns

Detailed Description

Export a Qt table model to a CSV file.

This is useful for analyzing or post-processing the data in a spreadsheet.

Definition at line 18 of file csvmodelwriter.h.

Constructor & Destructor Documentation

◆ CSVModelWriter()

CSVModelWriter::CSVModelWriter ( const QString & filename,
QObject * parent = nullptr )
explicit

Definition at line 11 of file csvmodelwriter.cpp.

Member Function Documentation

◆ addColumn()

void CSVModelWriter::addColumn ( const QString & title,
int column,
int role = Qt::EditRole )

Definition at line 22 of file csvmodelwriter.cpp.

Here is the caller graph for this function:

◆ setModel()

void CSVModelWriter::setModel ( const QAbstractItemModel * model)

Definition at line 17 of file csvmodelwriter.cpp.

Here is the caller graph for this function:

◆ write()

bool CSVModelWriter::write ( )

Perform export of the model to CSV.

Returns
true on success, false otherwise

Definition at line 49 of file csvmodelwriter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ columns

QList<Column> CSVModelWriter::columns
private

Definition at line 43 of file csvmodelwriter.h.

◆ filename

QString CSVModelWriter::filename
private

Definition at line 34 of file csvmodelwriter.h.

◆ model

const QAbstractItemModel* CSVModelWriter::model {nullptr}
private

Definition at line 35 of file csvmodelwriter.h.


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