Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

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

#include <csvmodelwriter.h>

+ Inheritance diagram for CSVModelWriter:
+ Collaboration diagram for CSVModelWriter:

Classes

struct  Column
 

Public Member Functions

 CSVModelWriter (const QString &filename, QObject *parent=0)
 
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 18 of file csvmodelwriter.h.

Constructor & Destructor Documentation

◆ CSVModelWriter()

CSVModelWriter::CSVModelWriter ( const QString &  filename,
QObject *  parent = 0 
)
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 
)

◆ setModel()

void CSVModelWriter::setModel ( const QAbstractItemModel *  model)

Definition at line 17 of file csvmodelwriter.cpp.

References model.

Referenced by TransactionView::exportClicked(), and AddressBookPage::on_exportButton_clicked().

◆ 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.

References columns, filename, model, writeNewline(), writeSep(), and writeValue().

Referenced by TransactionView::exportClicked(), and AddressBookPage::on_exportButton_clicked().

Member Data Documentation

◆ columns

QList<Column> CSVModelWriter::columns
private

Definition at line 43 of file csvmodelwriter.h.

Referenced by addColumn(), and write().

◆ filename

QString CSVModelWriter::filename
private

Definition at line 34 of file csvmodelwriter.h.

Referenced by write().

◆ model

const QAbstractItemModel* CSVModelWriter::model
private

Definition at line 35 of file csvmodelwriter.h.

Referenced by setModel(), and write().


The documentation for this class was generated from the following files:
Released under the MIT license