The ModelDataBinding class - the class that enables QtitanDataGrid grid columns to interact with model data. More...
Inherits QObject.
enum | RelationMode { NoRelation, Relation, MasterDetailsRelation } |
ModelDataBinding ( GridModelController * modelController, int column ) | |
virtual | ~ModelDataBinding () |
int | column () const |
QString | columnName () const |
QVariant | defaultValue ( Qt::ItemDataRole role = Qt::EditRole ) const |
Qt::ItemDataRole | displayRole () const |
Qt::ItemDataRole | editRole () const |
QModelIndex | findRelationModelIndex ( const QVariant & foreignKeyValue ) const |
int | foreignKeyColumn () const |
QString | foreignKeyColumnName () const |
Qt::ItemDataRole | foreignKeyMasterRole () const |
Qt::ItemDataRole | foreignKeyRole () const |
int | getForeignColumnMapping ( Qt::ItemDataRole role ) const |
QString | getForeignColumnNameMapping ( Qt::ItemDataRole role ) const |
Qt::ItemDataRole | getForeignRoleMapping ( Qt::ItemDataRole role ) const |
bool | getValue ( GridRow * row, Qt::ItemDataRole role, QVariant & retval ) const |
RelationMode | relationMode () const |
QAbstractItemModel * | relationModel () |
const QModelIndex & | relationParentIndex () const |
void | setColumn ( int column ) |
void | setDefaultValue ( const QVariant & value, Qt::ItemDataRole role = Qt::EditRole ) |
void | setDisplayRole ( Qt::ItemDataRole role = Qt::DisplayRole ) |
void | setEditRole ( Qt::ItemDataRole role = Qt::EditRole ) |
void | setForeignKey ( int foreignColumn, Qt::ItemDataRole foreignRole = Qt::DisplayRole, Qt::ItemDataRole masterRole = Qt::EditRole ) |
void | setForeignKey ( const QString & foreignColumnName, Qt::ItemDataRole foreignRole = Qt::DisplayRole, Qt::ItemDataRole masterRole = Qt::EditRole ) |
void | setRelationMode ( RelationMode mode ) |
void | setRelationModel ( QAbstractItemModel * model, QModelIndex parentIndex = QModelIndex() ) |
void | setRoleMapping ( Qt::ItemDataRole role, const QString & foreignColumnName, Qt::ItemDataRole foreignRole = Qt::DisplayRole ) |
void | setRoleMapping ( Qt::ItemDataRole role, int foreignColumn, Qt::ItemDataRole foreignRole = Qt::DisplayRole ) |
void | setSummaryRole ( Qt::ItemDataRole role = Qt::DisplayRole ) |
void | setSupportedSummaryTypes ( SummaryTypes types ) |
bool | setValue ( GridRow * row, Qt::ItemDataRole role, const QVariant & value ) |
Qt::ItemDataRole | summaryRole () const |
SummaryTypes | supportedSummaryTypes () const |
The ModelDataBinding class - the class that enables QtitanDataGrid grid columns to interact with model data.
The enumerator of the relation modes used in QtitanDataGrid. More information about relation modes can be found in this thread Relation mode in QtitanDataGrid
Constant | Value | Description |
---|---|---|
Qtitan::ModelDataBinding::NoRelation | 0 | The relation mode is not used. |
Qtitan::ModelDataBinding::Relation | 1 | Relation mode. This mode allows the developer to create a mechanism used in the QSqlRelationalTableModel class in Qt. |
Qtitan::ModelDataBinding::MasterDetailsRelation | 2 | A special mode that helps implement the relation of a master-detail in a grid cell. |
Returns a model column associated with the binding.
See also setColumn().
Returns the name of the model column assosicated with the binding.
Returns the default value of the grid column this relation (binding) is assocaited with. The value is not defined by default. The role parameter defines the role for which the default value should be obtained.
See also setDefaultValue().
Returns the role that should be used as the role for displaying the data of the Qt model. By default, Qt::DisplayRole is used.
See also setDisplayRole().
Returns the role that will be used as the role for editing data in the Qt model. Qt::EditRole is used by default.
See also setEditRole().
Searches for a cell in the relation model of the foreignKeyValue key by its value using the settings set with the setForeignKey() method. If the key is not found in the external model, an invalid QModelIndex is returned.
Returns the relation column of the model that is used for storing the external key. For more details, see the setForeignKey() method.
Returns the name of the relation column of the model that is used for storing the external key. For details, see the setForeignKey() method.
Returns the role of the model that is used for obtaining the external key for the current model. For more information, see the setForeignKey() method.
Returns the role of the relation model that is used for storing the external key. For more information, see the setForeignKey() method.
Returns the column of the external modeal that is mapped to the role of the current cell set by the role parameter.
Returns the name of the column in the external model that is mapped to the role of the current cell defined by the role parameter.
Returns the role of the external model that is mapped to the role of the current cell set by the role parameter.
Gets the value of the role role from the model for the grid row defined by the row parameter. If successful, the value is saved as the retval parameter and the function returns "true".
Returns the current relation mode used for this binding. By default, NoRelation is returned.
See also setRelationMode().
Returns a link to the external model.
See also setRelationModel().
Returns the index of the parent of the relation model. It's used for access to the lower levels of the hierarchy of the relation model.
See also column().
Defines the default value for the grid column this relation (binding) is associated with. When a new grid row is created, this value is used for cell initialization. The "role" parameter sets the role for which the default value needs to be obtained.
See also defaultValue().
Defines the role that should be used as the role for displaying the data of the Qt model.
See also displayRole().
Defines the role that should be used as the role for editing the data of the Qt model.
See also editRole().
Defines the settings of the external key for the current relation mode. foreignColumn - The column of the model that is used for storing the external key in an external model. foreignRole - The role for obtaining the external key from an external model. masterRole - The role for obtaining the value of the external key of the current cell.
Defines the settings of the external key for the current relation mode. foreignColumnName - The name of the column of the model that is used for storing the external key in an external model. foreignRole - The role for obtaining the external key from an external model. masterRole - The role for obtaining the value of the external key of the current cell.
Sets the Relation mode that should be used for the current binding. For more information about Relation modes, see Relation mode in QtitanDataGrid.
See also relationMode().
Defines the external model to be used in one of the Relation modes. The parentIndex parameter is used for gaining access to the lower levels of the hierarchy of the model set by the model parameter.
See also relationModel().
Defines the mapping rule for obtaining the value of the current cell for the role set by the role parameter. The value will be taken from the column of the external model set by the foreignColumnName parameter and the role set by the foreignRole role. Once the method is called and the grid needs to obtain the value for the role role from the current cell, the grid will use an external key set by the setForeignKey() function to determine a row in the external modeal and obtain this value from the foreignColumnName column and the foreignRole role.
Defines the mapping rule for obtaining the value of the current cell for the role set by the role parameter. The value will be taken from the column of the external model set by the foreignColumn parameter and the role set by the foreignRole role. Once the method is called and the grid needs to obtain the value for the role role from the current cell, the grid will use an external key set by the setForeignKey() function to determine a row in the external modeal and obtain this value from the foreignColumn column and the foreignRole role.
Defines the role for which summaries will be calculated if the user needs them.
See also summaryRole().
Defines acceptable summaries for binding.
See also supportedSummaryTypes().
Sets the value value of the role role of the model for the grid row defined by row parameter. If successful, the function returns "true".
Returns the role for which summaries will be calculated if the user needs them. By default, Qt::DisplayRole is used for calculating summaries.
See also setSummaryRole().
Returns acceptable summaries for binding.
See also setSupportedSummaryTypes().