4#include "include/schema/abstract_table_item.h"
6namespace ehm_dal::column_data {
19namespace ehm_dal::schema {
44 virtual void addChildItem(std::shared_ptr<AbstractIdTableItem> item,
54 virtual QVariant
childData(
const QModelIndex &index,
79 const QVariant &value,
81 std::vector<qint32> &modified_columns,
90 inline qint32
id()
const {
return id_; }
97 QVariant
id(
const qint32 role);
102 virtual QString
text()
const = 0;
103 Q_DECL_DEPRECATED QString displayText()
const {
return text(); }
108 virtual qint32
uid()
const;
117 QVariant
data(
const qint32 column,
126 virtual QVariant
data(
const QModelIndex &index,
175 const QVariant &value,
177 std::vector<qint32> &modified_columns,
188 virtual bool setData(
const QModelIndex &index,
189 const QVariant &value,
191 std::vector<qint32> &modified_columns,
211 virtual QVariant internalData(
const qint32 column,
const qint32 role)
const = 0;
214 virtual bool setInternalData(
const qint32 column,
215 const QVariant &value,
217 std::vector<qint32> &modified_columns);
The ColumnData class represents a container of ehm_dal::column_data::Column and attributes relating t...
Definition: column_data.h:19
The AbstractIdTableItem class represents a row in a Table with an id field.
Definition: abstract_id_table_item.h:26
virtual qint32 uid() const
Returns the row's unique database id. Not all tables use a uid.
qint32 id() const
Returns the row id. The first row of a table is 0, the second row is 1, etc.
Definition: abstract_id_table_item.h:90
virtual qint32 childItemId(const ehm_dal::tables::TableIndex child_table) const
Returns the item id number for the child data under the related child_table.
virtual void fixErrors()
Fixes any known errors with the item. E.g. errors introduced with a prior version of EHM DAL or the E...
Definition: abstract_id_table_item.h:198
virtual qint32 childRowCount(const ehm_dal::tables::TableIndex child_table) const
Returns the number of related child items in respect of child_table.
virtual qint32 parentItemId() const
Returns the item id of the items parent item. Applies to tree structures only.
virtual QVariant childData(const QModelIndex &index, qint32 role, ehm_dal::column_data::ColumnData *column_data, const ehm_dal::tables::TableIndex child_table) const
Returns child data stored under the given role for the selected index.
QVariant id(const qint32 role)
Returns the row id in a manner compatible with QAbstractTableModel item roles. This is generally unec...
QVariant data(const qint32 column, qint32 role, ehm_dal::column_data::ColumnData *column_data) const
Returns the row's data stored under the given role for the column.
virtual QStringList identifierList() const
Returns a list of all of the item's identifiers for matching against. This includes the main identifi...
bool setData(const qint32 column, const QVariant &value, qint32 role, std::vector< qint32 > &modified_columns, ehm_dal::column_data::ColumnData *column_data)
Sets the role data for the item at column to value.
virtual bool setData(const QModelIndex &index, const QVariant &value, qint32 role, std::vector< qint32 > &modified_columns, ehm_dal::column_data::ColumnData *column_data)
Sets the role data for the item at index to value.
virtual QString text() const =0
Returns the row's display text. This provides a convenient way to obtain a simple description of the ...
virtual QString identifier() const
Returns the item's text identifier for matching against.
virtual QVariant data(const QModelIndex &index, qint32 role, ehm_dal::column_data::ColumnData *column_data) const
Returns the row's data stored under the given role for the column referred to by the index.
bool alloc(const qint32 new_id)
Initialises the table item and allocates and item id to new_id and a uid (if applicable) and then cal...
virtual void addChildItem(std::shared_ptr< AbstractIdTableItem > item, const ehm_dal::tables::TableIndex child_table)
Adds the child item item from the child_table to the present tree table. This represents a tree relat...
virtual ~AbstractIdTableItem()
Default destructor.
virtual bool setChildData(const QModelIndex &index, const QVariant &value, const qint32 role, std::vector< qint32 > &modified_columns, ehm_dal::column_data::ColumnData *column_data, const ehm_dal::tables::TableIndex child_table)
Sets the role data for the child item at index to value.
AbstractIdTableItem()
Default constructor.
The AbstractTableItem class represents a row in a Table with no primary key (id/uid) field.
Definition: abstract_table_item.h:23
namespace ehm_dal::tables
Definition: column.h:4
TableIndex
The TableIndex enum represents the id number of each table within the database.
Definition: table_index.h:14