7#include <QAbstractItemModel>
43 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
54 for (
int i = 0; i <
columns.size(); ++i) {
64 for (
int i = 0; i <
columns.size(); ++i) {
77 return file.error() == QFile::NoError;
CSVModelWriter(const QString &filename, QObject *parent=nullptr)
bool write()
Perform export of the model to CSV.
void setModel(const QAbstractItemModel *model)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
const QAbstractItemModel * model
static void writeValue(QTextStream &f, const QString &value)
static void writeSep(QTextStream &f)
static void writeNewline(QTextStream &f)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...