gSAFE
1.3.8
|
#include <datalib.h>
Signals | |
void | dataUpdatedSignal (void) |
void | doWorking (void) |
void | endWorking (void) |
void | startWorking (void) |
Signals inherited from HDataField | |
void | dataChanged (void) |
void | disableControl (void) |
void | enableControl (void) |
void | updateStaticDisplayElementsSignal (void) |
Signals inherited from HSqlHandler | |
void | errorSignal (QString err) |
Public Member Functions | |
HSqlChoose (QString sqlc, QString ex, QString tit, QString def, QString ct, QString kf, QString sf, QString sfh, QString fp, QString op, QString inthash="", bool easyf=true) | |
HSqlChoose (HSqlChoose *t) | |
~HSqlChoose (void) | |
void | addExtraFunction (int pos, const QObject *receiver, QString text) |
void | addToolButton (const QObject *receiver, QString text) |
virtual QVariant | dbValueToDispValue (QVariant v) |
void | deepcopy_from (HSqlChoose *x) |
void | deferredSqlRefresh (void) |
void | disableEasyForm (void) |
void | enableEasyForm (void) |
virtual HDataField * | get_clone (void) |
QString | getConnectedTableName (void) |
bool | getEasyForm (void) |
QString | getFieldHeads (void) |
int | getGuiSortIndicator (void) |
QStringList & | getKeys (void) |
QString | getPopupDialogTitle (void) |
QStringList & | getSeparatedValues (void) |
virtual QString | getSQLValue (void) |
virtual QString | getSQLValueAsString (void) |
virtual QVariant | getValue (void) |
QStringList & | getValues (void) |
int | refreshSqlValues (bool emitsignal=true, bool tdisabled=false) |
void | removeExtraFunction (void) |
void | removeToolButton (void) |
void | resetPopupDialogTitle (void) |
virtual int | setDefval (QVariant v) |
void | setFilterPart (QString fp) |
void | setGuiSortIndicator (int i) |
void | setHashFunction (int(*nh)(const char *)) |
void | setInernalHashFunction (QString hashname) |
void | setPopupDialogTitle (QString title) |
virtual int | setValue (QVariant v, bool sdisabled=false) |
virtual QString | sqlCreateStringPart (QString switches="") |
virtual QString | sqlInsertHead (void) |
virtual QString | sqlInsertValue (void) |
virtual QString | sqlSelectHead (void) |
virtual QString | sqlUpdate (void) |
Public Member Functions inherited from HDataField | |
HDataField (QString _sqlColumn, QString _explain, QString tit, QString _tailstr="", bool _editable=true) | |
HDataField (HDataField *t) | |
~HDataField (void) | |
virtual bool | acceptFunction (void) |
virtual bool | acceptSubselect (void) |
void | addMark (QString mark) |
void | addMark (QStringList pmarkers) |
void | addNotValidValue (QString v) |
void | addRole (HDataFieldRole role) |
QStringList | allMarker (void) |
HDataField * | asColored (int r, int g, int b) |
HDataField * | asConstant (void) |
HDataField * | asHide (void) |
void | clearMarkers (void) |
void | clearNotValidValues (void) |
void | clearRoles (void) |
void | clearSqlSynced (void) |
void | deepcopy_from_hdatafield (HDataField *x) |
QVariant | defvalParser (QString s) |
void | delRole (QString name) |
void | doSet (void) |
int | editBoxMaxWidth (void) |
int | getBColor (void) |
QString | getDefaultValue (void) |
virtual QVariant | getDispValue () |
QString | getExplainText (void) |
QString | getFunction (void) |
int | getGColor (void) |
bool | getLastValidateStatus () |
bool | getPermanentValidateStatus () |
int | getPrintCellWidth (void) |
int | getRColor (void) |
QString | getSpecDisplaySortMode (void) |
QString | getSubselect (void) |
QString | getTailText (void) |
QString | getTitleText (void) |
bool | hasMark (QString mark) |
bool | isEditable (void) |
bool | isGuienabled (void) |
bool | isLogged (void) |
bool | isMeldedWithNext (void) |
bool | isNoMiddleStretch (void) |
bool | isPrintCellWrap (void) |
bool | isReallyChanged (void) |
bool | isSet (void) |
bool | isShow (void) |
bool | isSQLField (void) |
virtual QString | lowerValidate (void) |
void | meldWithNext (void) |
void | noMiddleStretch (void) |
void | notSet (void) |
void | resetFunction (void) |
void | resetLogging (void) |
void | resetMeldWithNext (void) |
void | resetNoMiddleStretch (void) |
void | resetSubselect (void) |
void | resetValidateStatus () |
int | returnToDefault (void) |
void | setColor (int r, int g, int b) |
void | setData (QString _sqlColumn, QString _explain, QString tit, QString _tailstr="", bool _editable=true) |
void | setEditable (void) |
void | setEditBoxMaxWidth (int max) |
void | setExplainText (QString expl) |
void | setFunction (QString func) |
void | setGuidisabled (void) |
void | setGuienabled (void) |
void | setHide (void) |
void | setLogging (void) |
void | setMaulallyValidateError (QString message) |
void | setNotValidValues (QStringList nvl) |
void | setPrintCellNoWrap (void) |
void | setPrintCellWidth (int w) |
void | setPrintCellWrap (void) |
void | setReadonly (void) |
void | setShow (void) |
void | setSpecDisplaySortMode (QString m) |
void | setSubselect (QString subs) |
void | setTailText (QString tail) |
void | setTitleText (QString titl) |
void | setValidator (QString v="") |
void | sqlSynced (HDataChangeLogger *dclog=NULL, bool forcechange=false, bool forcelog=false) |
void | useRole (QString name) |
QString | validate (void) |
virtual void | value_changed () |
Public Member Functions inherited from HSqlHandler | |
HSqlHandler (void) | |
~HSqlHandler (void) | |
QSqlQuery * | allocateQSqlQuery (void) |
void | cloneSqlSettingsFrom (HSqlHandler *other) |
void | commit (void) |
bool | errorStatus (void) |
void | rollback (void) |
bool | submit0ResultQuery (QString q, QString err, bool tdisabled=false) |
QVariant | submit1ResultQuery (QString q, QString err, bool tdisabled=false) |
HPlainDataMatrix * | submitNResultQuery (int N, QString q, QString err, bool tdisabled=false) |
void | transaction (void) |
QSqlDatabase | workDB (void) |
Public Member Functions inherited from HSqlInterface | |
HSqlInterface () | |
~HSqlInterface () | |
void | cloneSqlInterfaceSettingsFrom (HSqlInterface *other) |
HSqlSingleInterface * | myInterface (void) |
QString | sqlConcatenateToLocal (QString string) |
QString | sqlConcatenateToLocal (QStringList fields) |
Public Member Functions inherited from HBase | |
HBase (void) | |
~HBase (void) | |
QString | getWhoami (void) |
Public Attributes | |
QString | btext |
const QObject * | extrafunc_receiver [5] |
QString | extrafunc_text [5] |
bool | progress_on_read |
QString | toolbarbutton_down_text |
const QObject * | toolbrec |
Public Attributes inherited from HDataField | |
QString | conn_sqlTable |
bool | connected |
Protected Attributes | |
QString | connected_table |
bool | easyform |
QString | filter_part |
int(* | hash )(const char *) |
QString | key_field |
QStringList | keys |
int | maxhash |
QString | order_part |
KVPair * | pairs |
QString | popupdialog_title |
bool | readed_reftable |
QStringList | sepvalues |
QString | showed_field |
QString | showed_field_head |
int | sortc |
QString | value |
QStringList | values |
Protected Attributes inherited from HDataField | |
int | color_b |
int | color_g |
int | color_r |
QString | defval |
QString | derived |
bool | editable |
int | editboxmaxwidth |
QString | explain |
QString | function |
bool | guienabled |
bool | lastvalidate_result |
bool | logged |
QString | manual_validate_error |
QStringList | markers |
bool | meldwithnext |
bool | nomiddlestretch |
QStringList | notvalid |
bool | permanentvalidate_result |
QList< HDataFieldRole > | roles |
int | set |
bool | show |
QString | spec_disp_sort |
bool | sql |
QString | sqlColumn |
bool | sync_valueInSql |
QString | tailstr |
QString | title |
QString | valid |
QString | valueInSql |
bool | wcell_print |
int | wcellw_print |
Protected Attributes inherited from HSqlHandler | |
bool | query_error_occured |
Protected Attributes inherited from HBase | |
QString | whoami |
Additional Inherited Members | |
Public Slots inherited from HDataField | |
void | disableControlSlot (void) |
void | enableControlSlot (void) |
Static Public Member Functions inherited from HSqlHandler | |
static void | setCustomSqlDatabase (QString databaseName, QString sqlinterfacename="") |
static void | setDefaultSqlDatabase (void) |
Static Public Member Functions inherited from HSqlInterface | |
static HSqlSingleInterface * | currentDefaultSqlInterface (void) |
static HSqlSingleInterface * | getSqlInterface (QString interfacename) |
static void | setSqlMode (QString modename) |
static void | setSqlModeBackToFirst (void) |
Static Public Attributes inherited from HSqlHandler | |
static int | trans = 0 |
This is a field type class. The HSqlChoose holds a key value which is pointed a record in a different table. This field is a varchar in the database. You can browse the elements of the referenced table, and after you finish The field's value will contain the key of the selected record.
You have to set many parameters to specify this connection (You can see examples in brackets)
When the records of the referenced table are queried the select looks like this (according to example):
SELECT p_id,firstname || '|' || lastname || '|' || birthdate FROM persons WHERE age > 18 ORDER BY firstname,lastname,birthdate;
The HSqlChoose have two gui method to select the referenced record. This two modes can be set by easyform attribute:
The HSqlChoose uses a hash mechanism to store the keys. You can use three different hash function to speed up the browsing "nullhash","charcodehash","dropchar" .
Gui appearance: A combobox with a refresh button if easyform is true, otherwise a simple push button with a selected value. If you hit this pushbutton a new dialog is popupped with an element browser. (easyform-true: QComboBox easyform-false: HDialog,HTableBrowser)
HSqlChoose::HSqlChoose | ( | QString | sqlc, |
QString | ex, | ||
QString | tit, | ||
QString | def, | ||
QString | ct, | ||
QString | kf, | ||
QString | sf, | ||
QString | sfh, | ||
QString | fp, | ||
QString | op, | ||
QString | inthash = "" , |
||
bool | easyf = true |
||
) |
Constructor. Creates a HSqlChoose
sqlc | the sql name of the field |
ex | the explain text of the field |
tit | the title text of the field |
def | the default text of the field |
ct | is the connected_table (See class details) |
kf | is the key_field (See class details) |
sf | is the showed_field (See class details) |
sfh | is the showed_field_head (See class details) |
fp | is the filter_part (See class details) |
op | is the order_part (See class details) |
inthash | is the internal hash function specifier: can be "nullhash","charcodehash","dropchar" |
easyform | if this true (default) the HSqlChoose initialized in easyform. |
Definition at line 7101 of file datalib.cpp.
HSqlChoose::~HSqlChoose | ( | void | ) |
Destructor
Definition at line 7150 of file datalib.cpp.
HSqlChoose::HSqlChoose | ( | HSqlChoose * | t | ) |
Deepcopy constructor
Definition at line 7156 of file datalib.cpp.
void HSqlChoose::addExtraFunction | ( | int | pos, |
const QObject * | receiver, | ||
QString | text | ||
) |
When the HSqlChoose is in normal mode (The selection achived with a popupped dialog) you can add a plus position dependent popup menu(whith mouse right click), which can activated on the records of the referenced table. You can define more menu items (maximum 5). Every menu items have a receiver QObject which have to have a "extrafunc_X(QString key)" slot to handle the activating the menu. The X can be 0,1,2,3 or 4.
For example if you call addExtraFunction(0,myobj,"Do something") that case if you click a right mouse button on an element of the referenced table a popupmenu will appear which will have a "Do something" menuitem. That case you click on this menu the "extrafunc_0(QString)" slot of myobj is activated, and the parameter will be the key value of the selected record.
Have to call before the initialization of gui.
pos | the positon of the added menu. 0<= pos <5 |
receiver | the QObject descendant which have a "extrafunc_POS(QString) slot. |
text | the text of the added menu item. |
Definition at line 7498 of file datalib.cpp.
void HSqlChoose::addToolButton | ( | const QObject * | receiver, |
QString | text | ||
) |
When the HSqlChoose is in normal mode (The selection achived with a popupped dialog) you can add a plus push button to that popupped dialog. You can specify a function (slot) which called when this button is pressed.
When the user push this button the gSAFE activates the "toolbuttonclicked" slot of the "receiver" QObject.
The gSAFE also try to connect to the "setKeyTo(QString)" signal of the "receiver".(optional) The called subprogram can set the current value by this signal. Useful if you use this plus button to add new element to the record list. After addig the record you can make immediately active with the setKeyTo signal.
Have to call before the initialization of gui.
receiver | the receiver QObject descendant which have a toolbuttonclicked slot and an optional setKeyTo(QString) signal |
text | the text of the button |
Definition at line 7486 of file datalib.cpp.
|
virtual |
Converting function, you can give a HDataFiled(or descendant) value to this function, and you get the corresponding sql value of the given value.
This function usally redefined in descendats!
In simple typed fields this function do a trivial conversion for example a text field do "text"->"'text'" conversion. Other cases where the field is more complex (HSqlChoose for example) this conversion can be more complex.
In HSqlChoose can be:
"Joe Black" -> "id_0123"
"Little Richard" -> "id_03453"
"John Wayne" -> "id_0197"
etc...
In a HCharHash the result can be:
"Animal" -> "a"
"Plant" -> "p"
"Objects" -> "o"
etc...
Reimplemented from HDataField.
Definition at line 7315 of file datalib.cpp.
void HSqlChoose::deepcopy_from | ( | HSqlChoose * | x | ) |
Deepcopy from the given parameter
Definition at line 7162 of file datalib.cpp.
|
inline |
Makes a refreshSqlValues() the next necessary time. It does not trigger an immedialty refreshSqlValues() but is emits when it needs same data)
void HSqlChoose::disableEasyForm | ( | void | ) |
Sets the HSqlChoose to easyform=false (See class details)
Definition at line 7479 of file datalib.cpp.
|
signal |
When using a work indicator: This signal is emitted when a work continues
void HSqlChoose::enableEasyForm | ( | void | ) |
Sets the HSqlChoose to easyform=true (See class details)
Definition at line 7473 of file datalib.cpp.
|
signal |
When using a work indicator: This signal is emitted when a work finished
|
virtual |
Returns a clone of this field
Reimplemented from HDataField.
Definition at line 7198 of file datalib.cpp.
|
inline |
Returns true if the HSqlChoose in easyform, otherwise false (See class details)
|
inline |
|
inline |
QStringList & HSqlChoose::getKeys | ( | void | ) |
Returns the cached keys (readed keys of the records of the referenced table)
Definition at line 7346 of file datalib.cpp.
|
inline |
QStringList & HSqlChoose::getSeparatedValues | ( | void | ) |
Returns the separated values
Definition at line 7360 of file datalib.cpp.
|
virtual |
Returns the value of the field in that format which accepted by the sql database.
Reimplemented from HDataField.
Definition at line 7435 of file datalib.cpp.
|
virtual |
Returns string format of the field's value. Very similar to getSQLValue() but the result is always acceptable in an sql varchar field. (Mostly used by the logger system, when every kind of values are stored in varchar. The gsafe try to keep the value as close to the original sql database value as possible)
Reimplemented from HDataField.
Definition at line 7443 of file datalib.cpp.
|
virtual |
Returns the value of the field.
Reimplemented from HDataField.
Definition at line 7430 of file datalib.cpp.
QStringList & HSqlChoose::getValues | ( | void | ) |
Returns the cached values (readed keys of the records of the referenced table)
Definition at line 7353 of file datalib.cpp.
int HSqlChoose::refreshSqlValues | ( | bool | emitsignal = true , |
bool | tdisabled = false |
||
) |
Makes the HSqlChoose to refresh the records of the referenced table.
emitsignal | is true the finction emits the dataUpdatedSignal() after the work. |
tdisabled | FALSE:It is submitted in a new separate transaction, TRUE:Don's start a new transaction |
Definition at line 7203 of file datalib.cpp.
void HSqlChoose::removeExtraFunction | ( | void | ) |
Removes all positon dependent popup menu in the popup selector
Definition at line 7504 of file datalib.cpp.
void HSqlChoose::removeToolButton | ( | void | ) |
Remove the plus toolbar button in normal mode.
Definition at line 7492 of file datalib.cpp.
|
inline |
Sets the title of the popupdialog to empty ("") when the HSqlChoose in normal mode
|
virtual |
Sets the default value of the field.
Reimplemented from HDataField.
Definition at line 7367 of file datalib.cpp.
void HSqlChoose::setFilterPart | ( | QString | fp | ) |
Sets the filter part of HSqlChoose
Definition at line 7340 of file datalib.cpp.
|
inline |
|
inline |
void HSqlChoose::setInernalHashFunction | ( | QString | hashname | ) |
Sets the key-value hash function by name
Definition at line 7525 of file datalib.cpp.
|
inline |
Sets the title of the popupdialog when the HSqlChoose in normal mode
|
virtual |
Sets the value of the field.
sdisabled | if this parameter is true the dataChanged() signal is disabled |
Reimplemented from HDataField.
Definition at line 7416 of file datalib.cpp.
|
virtual |
Returns the part of the CREATE TABLE sql command which creates this field
Reimplemented from HDataField.
Definition at line 7513 of file datalib.cpp.
|
virtual |
Returns the sql name of the field (in insert) This function can be redefined in descendats!
Reimplemented from HDataField.
Definition at line 7448 of file datalib.cpp.
|
virtual |
Returns the sql value of the field (in insert) This function can be redefined in descendats!
Reimplemented from HDataField.
Definition at line 7453 of file datalib.cpp.
|
virtual |
Returns the sql name of the field (in select) This function can be redefined in descendats!
Reimplemented from HDataField.
Definition at line 7467 of file datalib.cpp.
|
virtual |
Returns the sql update part of the field ( name='VALUE' ) This function can be redefined in descendats!
Reimplemented from HDataField.
Definition at line 7460 of file datalib.cpp.
|
signal |
When using a work indicator: This signal is emitted when a work begins
QString HSqlChoose::btext |
const QObject* HSqlChoose::extrafunc_receiver[5] |
Extrafunctions receivers see addExtraFunction()
QString HSqlChoose::extrafunc_text[5] |
Extrafunctions texts see addExtraFunction()
|
protected |
bool HSqlChoose::progress_on_read |
If this attribute is true the HSqlChoose show a graphical work indicator at time dependent sql reads
const QObject* HSqlChoose::toolbrec |