Fabcoin Core  0.16.2
P2P Digital Currency
csvmodelwriter.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef FABCOIN_QT_CSVMODELWRITER_H
6 #define FABCOIN_QT_CSVMODELWRITER_H
7 
8 #include <QList>
9 #include <QObject>
10 
11 QT_BEGIN_NAMESPACE
12 class QAbstractItemModel;
13 QT_END_NAMESPACE
14 
18 class CSVModelWriter : public QObject
19 {
20  Q_OBJECT
21 
22 public:
23  explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
24 
25  void setModel(const QAbstractItemModel *model);
26  void addColumn(const QString &title, int column, int role=Qt::EditRole);
27 
31  bool write();
32 
33 private:
34  QString filename;
35  const QAbstractItemModel *model;
36 
37  struct Column
38  {
39  QString title;
40  int column;
41  int role;
42  };
43  QList<Column> columns;
44 };
45 
46 #endif // FABCOIN_QT_CSVMODELWRITER_H
void addColumn(const QString &title, int column, int role=Qt::EditRole)
QList< Column > columns
Export a Qt table model to a CSV file.
const QAbstractItemModel * model
CSVModelWriter(const QString &filename, QObject *parent=0)
void setModel(const QAbstractItemModel *model)
bool write()
Perform export of the model to CSV.