19#include <QAbstractItemModel>
36 UatModel(QObject *parent, uat_t *uat = 0);
43 UatModel(QObject *parent, QString tableName);
50 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
58 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
67 QVariant
headerData(
int section, Qt::Orientation orientation,
68 int role = Qt::DisplayRole)
const override;
75 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
82 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
91 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole)
override;
100 bool insertRows(
int row,
int count,
const QModelIndex &parent = QModelIndex())
override;
109 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex())
override;
123 QModelIndex
copyRow(QModelIndex original);
131 bool moveRow(
int src_row,
int dst_row);
142 bool moveRows(
const QModelIndex &sourceParent,
int sourceRow,
int count,
const QModelIndex &destinationParent,
int destinationChild)
override;
160 bool dropMimeData(
const QMimeData *
data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent)
override;
202 QModelIndex
findRowForColumnContent(QVariant columnContent,
int columnToCheckAgainst,
int role = Qt::DisplayRole);
212 bool checkField(
int row,
int col,
char **error)
const;
219 QList<int> checkRow(
int row);
225 void loadUat(uat_t * uat = 0);
233 bool moveRowPrivate(
int src_row,
int dst_row);
242 QVector<bool> dirty_records;
245 QVector<QMap<int, QString> > record_errors;
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Retrieves header data for the table.
Definition uat_model.cpp:277
bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override
Moves multiple rows from one position to another.
Definition uat_model.cpp:577
UatModel(QObject *parent, uat_t *uat=0)
Constructs a new UatModel object using a UAT structure.
Definition uat_model.cpp:31
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Inserts a specified number of rows into the model.
Definition uat_model.cpp:444
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Removes a specified number of rows from the model.
Definition uat_model.cpp:475
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under a given parent.
Definition uat_model.cpp:294
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns under a given parent.
Definition uat_model.cpp:304
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for a given index.
Definition uat_model.cpp:118
bool revertChanges(QString &error)
Definition uat_model.cpp:100
bool applyChanges(QString &error)
Definition uat_model.cpp:75
QModelIndex appendEntry(QVariantList row)
Appends a new entry to the end of the table.
Definition uat_model.cpp:314
void clearAll()
Clears all entries from the model.
Definition uat_model.cpp:492
bool moveRow(int src_row, int dst_row)
Moves a row from one position to another.
Definition uat_model.cpp:572
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Sets the data for a specific index.
Definition uat_model.cpp:367
Qt::DropActions supportedDropActions() const override
Returns the supported drag and drop actions for the model.
Definition uat_model.cpp:661
QModelIndex copyRow(QModelIndex original)
Copies an existing row and inserts the copy.
Definition uat_model.cpp:505
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handles dropped MIME data to perform drag and drop operations.
Definition uat_model.cpp:666
QModelIndex findRowForColumnContent(QVariant columnContent, int columnToCheckAgainst, int role=Qt::DisplayRole)
Finds the first row containing specific content in a given column.
Definition uat_model.cpp:262
void reloadUat()
Reloads the UAT data from the underlying structure.
Definition uat_model.cpp:61
bool hasErrors() const
Checks if any records in the model currently have validation errors.
Definition uat_model.cpp:608
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Retrieves data for a given index and role.
Definition uat_model.cpp:172