Bitcoin ABC 0.30.7
P2P Digital Currency
Classes | Public Member Functions | Private Attributes | List of all members
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. More...
 

Private Attributes

QString filename
 
const QAbstractItemModel * model
 
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 19 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 18 of file csvmodelwriter.cpp.

Here is the caller graph for this function:

◆ setModel()

void CSVModelWriter::setModel ( const QAbstractItemModel *  model)

Definition at line 14 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 41 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 42 of file csvmodelwriter.h.

◆ filename

QString CSVModelWriter::filename
private

Definition at line 34 of file csvmodelwriter.h.

◆ model

const QAbstractItemModel* CSVModelWriter::model
private

Definition at line 35 of file csvmodelwriter.h.


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