dogecoin/src/qt/csvmodelwriter.h

47 lines
1.1 KiB
C
Raw Normal View History

2014-01-05 21:03:23 +01:00
// Copyright (c) 2011-2014 The Bitcoin Core developers
2014-12-13 05:09:33 +01:00
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-11-03 16:16:40 +01:00
#ifndef BITCOIN_QT_CSVMODELWRITER_H
#define BITCOIN_QT_CSVMODELWRITER_H
#include <QList>
#include <QObject>
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
QT_END_NAMESPACE
2011-11-13 13:19:52 +01:00
/** Export a Qt table model to a CSV file. This is useful for analyzing or post-processing the data in
a spreadsheet.
*/
class CSVModelWriter : public QObject
{
Q_OBJECT
public:
explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
void setModel(const QAbstractItemModel *model);
void addColumn(const QString &title, int column, int role=Qt::EditRole);
2011-11-13 13:19:52 +01:00
/** Perform export of the model to CSV.
@returns true on success, false otherwise
*/
bool write();
private:
QString filename;
const QAbstractItemModel *model;
struct Column
{
QString title;
int column;
int role;
};
QList<Column> columns;
};
2014-11-03 16:16:40 +01:00
#endif // BITCOIN_QT_CSVMODELWRITER_H