DbModel Pile
version 0.0.1
DbModel pile.
|
Model representation of a column. More...
#include <dbmodelcol.h>
Public Member Functions | |
DbModelCol () | |
Default constructor creates a non-foreign key column. | |
DbModelCol (const DbColumn &source, int user_index, const DbModelTbl &table) | |
Default constructor creates a non-foreign key column. | |
DbModelCol (const DbModelCol &other) | |
Copy constructor. | |
DbModelCol & | operator= (const DbModelCol &other) |
Assignment operator. | |
~DbModelCol () | |
destructor | |
bool | isForeign () const |
Tell if this column is foreign or not. | |
bool | setCombo (QComboBox *control, const QVariant &key, bool b_delegate_enh=true) const |
Set a combobox to work with this column's data. | |
bool | getComboValue (const QModelIndex &index, DbModel *top_model, QComboBox *control) const |
Retreives the value and saves it back in the model. | |
QVariant | comboResult (DbModel *top_model, QComboBox *control) const |
Get the result from a foreign key combo. | |
QVariant | comboInsert (DbModel *top_model, const QString &value) const |
bool | getTristateValue (const QModelIndex &index, DbModel *top_model, QCheckBox *control) const |
Retreives the value and saves it back in the model. | |
bool | setTristate (QCheckBox *control, const QVariant &value, bool b_delegate_enh) const |
Prepare a checkbox to handle tristaed values. | |
int | mainTableRealIndex () const |
int | mainTableVirtualIndex () const |
Public Attributes | |
int | user_index_ |
const DbModelTbl * | table_ |
int | t_primary_ |
int | t_display_ |
QString | label_ |
DbColumn | original_ |
Model representation of a column.
One such structure is created for each column that the user sees. At load time the table is inspected, each column is iterated and one or more such structures are created.
If the column is not a foreign key then only user_index_
, and table_
are used, with t_primary_
set to -1 to indicate that this is not a foreign column.
If the column is a foreign on then the value in main table is to be searched in secondary table (t_display_
), on t_primary_
column. Once found, the user should be presented with the value stored in column t_display_
.
This system enables the user to present any number of columns from a secondary table while using a single foreign key column in main table.
QString DbModelCol::label_ |
cached label for the header
DbColumn DbModelCol::original_ |
original column data
int DbModelCol::t_display_ |
column index in referenced table (-1 indicates this is a local column) of the display
int DbModelCol::t_primary_ |
column index in referenced table (-1 indicates this is a local column) of the key
const DbModelTbl* DbModelCol::table_ |
the table that holds information that this column shows
int DbModelCol::user_index_ |
index of this column in mapping_