aboutsummaryrefslogtreecommitdiff
path: root/src/qt/csvmodelwriter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/csvmodelwriter.h')
-rw-r--r--src/qt/csvmodelwriter.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/qt/csvmodelwriter.h b/src/qt/csvmodelwriter.h
new file mode 100644
index 0000000000..7367f3a6a9
--- /dev/null
+++ b/src/qt/csvmodelwriter.h
@@ -0,0 +1,43 @@
+#ifndef CSVMODELWRITER_H
+#define CSVMODELWRITER_H
+
+#include <QObject>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QAbstractItemModel;
+QT_END_NAMESPACE
+
+// Export TableModel to CSV file
+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);
+
+ // Perform write operation
+ // 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;
+
+signals:
+
+public slots:
+
+};
+
+#endif // CSVMODELWRITER_H