Update CMakeLists.txt - play with openssl
[novacoin.git] / src / qt / csvmodelwriter.h
1 #ifndef CSVMODELWRITER_H
2 #define CSVMODELWRITER_H
3
4 #include <QObject>
5 #include <QList>
6
7 QT_BEGIN_NAMESPACE
8 class QAbstractItemModel;
9 QT_END_NAMESPACE
10
11 /** Export a Qt table model to a CSV file. This is useful for analyzing or post-processing the data in
12     a spreadsheet.
13  */
14 class CSVModelWriter : public QObject
15 {
16     Q_OBJECT
17 public:
18     explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
19
20     void setModel(const QAbstractItemModel *model);
21     void addColumn(const QString &title, int column, int role=Qt::EditRole);
22
23     /** Perform export of the model to CSV.
24         @returns true on success, false otherwise
25     */
26     bool write();
27
28 private:
29     QString filename;
30     const QAbstractItemModel *model;
31
32     struct Column
33     {
34         QString title;
35         int column;
36         int role;
37     };
38     QList<Column> columns;
39
40 signals:
41
42 public slots:
43
44 };
45
46 #endif // CSVMODELWRITER_H