gSAFE  1.3.8
Public Slots | Signals | Public Member Functions | Public Attributes | Protected Attributes | List of all members
HDataField Class Reference

#include <datalib.h>

Inheritance diagram for HDataField:
HSqlHandler HSqlInterface HBase HCharHash HCheck HConnect HDate HFloating HKey HLargeText HNumber HNumHash HSmallText HSqlChoose HStatic HTimestamp

Public Slots

void disableControlSlot (void)
 
void enableControlSlot (void)
 

Signals

void dataChanged (void)
 
void disableControl (void)
 
void enableControl (void)
 
void updateStaticDisplayElementsSignal (void)
 
- Signals inherited from HSqlHandler
void errorSignal (QString err)
 

Public Member Functions

 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)
 
HDataFieldasColored (int r, int g, int b)
 
HDataFieldasConstant (void)
 
HDataFieldasHide (void)
 
void clearMarkers (void)
 
void clearNotValidValues (void)
 
void clearRoles (void)
 
void clearSqlSynced (void)
 
virtual QVariant dbValueToDispValue (QVariant v)
 
void deepcopy_from_hdatafield (HDataField *x)
 
QVariant defvalParser (QString s)
 
void delRole (QString name)
 
void doSet (void)
 
int editBoxMaxWidth (void)
 
virtual HDataFieldget_clone (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)
 
virtual QString getSQLValue (void)
 
virtual QString getSQLValueAsString (void)
 
QString getSubselect (void)
 
QString getTailText (void)
 
QString getTitleText (void)
 
virtual QVariant getValue (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)
 
virtual int setDefval (QVariant v)
 
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="")
 
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)
 
void sqlSynced (HDataChangeLogger *dclog=NULL, bool forcechange=false, bool forcelog=false)
 
virtual QString sqlUpdate (void)
 
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)
 
HPlainDataMatrixsubmitNResultQuery (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)
 
HSqlSingleInterfacemyInterface (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 conn_sqlTable
 
bool connected
 

Protected Attributes

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< HDataFieldRoleroles
 
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

- 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 HSqlSingleInterfacecurrentDefaultSqlInterface (void)
 
static HSqlSingleInterfacegetSqlInterface (QString interfacename)
 
static void setSqlMode (QString modename)
 
static void setSqlModeBackToFirst (void)
 
- Static Public Attributes inherited from HSqlHandler
static int trans = 0
 

Detailed Description

HDataField is the base SQL field class. Every data field inherited from this class. It means that the HTableBase (so the HTable and HList too) contains HTableField descendants as data fields. As the base data field class, you can specify many properties which are in all field. This common attributes:

You can use a role system to set some attributes together to customize the tables to different environments. (See: HDataFieldRole)

Every new data type and field have to inherit from here, because the HTable,HList,HTableBase,etc classes use functions of this class to build the sql queries set the values, etc. If a data field require a different kind of sql handling, it has to redefine the functions of HDataField.

Definition at line 2069 of file datalib.h.

Constructor & Destructor Documentation

HDataField::HDataField ( QString  _sqlColumn,
QString  _explain,
QString  tit,
QString  _tailstr = "",
bool  _editable = true 
)

Constructor. Creates an HDataField instance. About the meaning of parameters see the class description.

Parameters
_sqlColumnsets the sqlColumn attribute
_explainsets the explain text of the field
titsets the title text of the field
_tailstrsets the tail text of the field
_editablesets the editable attribute of the field

Definition at line 5073 of file datalib.cpp.

HDataField::~HDataField ( void  )

Destructor

Definition at line 5180 of file datalib.cpp.

HDataField::HDataField ( HDataField t)

Deepcopy constructor. It clones the parameter HDataField to itself. It copies the full data structure and state and attributes and values of the parameter field.

Parameters
tthe source field

Definition at line 5118 of file datalib.cpp.

Member Function Documentation

virtual bool HDataField::acceptFunction ( void  )
inlinevirtual

If this functions returns true then the field accepts sql functions. Otherwise the setFunction() function is do nothing This function can be redefined in descendats!

See Also
setFunction

Reimplemented in HDate, HFloating, HNumber, HLargeText, and HSmallText.

Definition at line 2388 of file datalib.h.

virtual bool HDataField::acceptSubselect ( void  )
inlinevirtual

If this functions returns true then the field accepts sql subselects instead of read a simple value. Otherwise setSubselect() function is do nothing This function can be redefined in descendats!

See Also
setSubselect

Reimplemented in HDate, HFloating, HNumber, HLargeText, and HSmallText.

Definition at line 2407 of file datalib.h.

void HDataField::addMark ( QString  mark)

Adds a new marker to the field. You can use this markes in higher levels (HTableBase,HTable,HList) You can create groups of fields with these markers, and later you can set some attribute or do something in batch on this group. Every field can have more markers, and later you can hide,show,coloring,set readonly, or do other things on fields which are marked with a specified marker. The markers are strings.

Parameters
markmarker to add.
See Also
hasMark()
clearMarkers()
allMarker()

Definition at line 5460 of file datalib.cpp.

void HDataField::addMark ( QStringList  pmarkers)

Adds more then one marker to the field

See Also
addMark()

Definition at line 5466 of file datalib.cpp.

void HDataField::addNotValidValue ( QString  v)

Adds a disabled value (Can be added more than one disabled value) If the user modified a value which match with one of this disabled values the validation reject the modification.

Definition at line 5196 of file datalib.cpp.

void HDataField::addRole ( HDataFieldRole  role)

Add a new role to this field. Every field can have more different named roles.

See Also
HDataFieldRole

Definition at line 5489 of file datalib.cpp.

QStringList HDataField::allMarker ( void  )

Returns all markers of the field

See Also
addMark()

Definition at line 5484 of file datalib.cpp.

HDataField* HDataField::asColored ( int  r,
int  g,
int  b 
)
inline

Sets the color of the field and return it

Parameters
rred component value 0-255
ggreen component value 0-255
bblue component value 0-255
See Also
setColor()

Definition at line 2344 of file datalib.h.

HDataField* HDataField::asConstant ( void  )
inline

Sets the field to readonly, and return it

Definition at line 2324 of file datalib.h.

HDataField* HDataField::asHide ( void  )
inline

Sets the field to hide, and return it

Definition at line 2326 of file datalib.h.

void HDataField::clearMarkers ( void  )

Clears all markers on this field.

See Also
addMark()

Definition at line 5479 of file datalib.cpp.

void HDataField::clearNotValidValues ( void  )

Clears all disabled value

See Also
addNotValidValue()

Definition at line 5201 of file datalib.cpp.

void HDataField::clearRoles ( void  )

Clears every roles from this data field.

See Also
HDataFieldRole

Definition at line 5509 of file datalib.cpp.

void HDataField::clearSqlSynced ( void  )

Clears the valueInSql and sync_valueInSql attributes to the default. It meand that this field lose the information about the value in sql. Use this function if you detach the fild from the sql field. For example if you readed a HTable record and you want to save as another independent record.

See Also
sqlSynced()

Definition at line 5583 of file datalib.cpp.

void HDataField::dataChanged ( void  )
signal

Signs if the data changed. This passed to the HTableBase.

QVariant HDataField::dbValueToDispValue ( QVariant  v)
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 in HSqlChoose, HTimestamp, HFloating, HCheck, HNumber, HNumHash, HCharHash, and HSmallText.

Definition at line 5309 of file datalib.cpp.

void HDataField::deepcopy_from_hdatafield ( HDataField x)

Deepcopy function. It clones the parameter HDataField to itself. It copies the full data structure and state and attributes and values of the parameter field.

Parameters
tthe source field

Definition at line 5123 of file datalib.cpp.

QVariant HDataField::defvalParser ( QString  s)

Reads the given default value text and returns as a HDataField value.
If you pass "DEFVAL_SQL(query_text)" string as default text, the "query_text" will be executed in sql database by this function, and the really defval will be the result. Usally you don't need to call this function. It's called by other functions automatically.

Definition at line 5326 of file datalib.cpp.

void HDataField::delRole ( QString  name)

Delete the parameter named role from this field.

See Also
HDataFieldRole

Definition at line 5494 of file datalib.cpp.

void HDataField::disableControlSlot ( void  )
inlineslot

Emits the disableControl signal. According to gui this usally makes the editable field to disabled in gui This means the setEnabled(bool) Qt QWidget function. (This means the element will be disabled) (Visible but not editable)

Definition at line 2565 of file datalib.h.

void HDataField::doSet ( void  )
inline

Sets the field's modified status to modified!

See Also
isSet()

Definition at line 2311 of file datalib.h.

int HDataField::editBoxMaxWidth ( void  )
inline

Returns the maximum width of the QLineEdit boxes when the field is edited in a HDispTable.

See Also
setEditBoxMaxWidth()

Definition at line 2382 of file datalib.h.

void HDataField::enableControlSlot ( void  )
inlineslot

Emits the enableControl signal. Enables the previously disabled field

See Also
disableControlSlot()

Definition at line 2568 of file datalib.h.

HDataField * HDataField::get_clone ( void  )
virtual

Gives a clone of this HTableField (or descendants).

See Also
deepcopy_from_hdatafield()

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5175 of file datalib.cpp.

int HDataField::getBColor ( void  )
inline

Returns the blue component of the field's color

Definition at line 2338 of file datalib.h.

QString HDataField::getDefaultValue ( void  )
inline

Returns the default value of the field in string format

Definition at line 2220 of file datalib.h.

virtual QVariant HDataField::getDispValue ( )
inlinevirtual

Returns the current value in sql format. Actually calls dbValueToDispValue() to the current value This function can be redefined in descendats!

See Also
dbValueToDispValue()

Definition at line 2267 of file datalib.h.

QString HDataField::getExplainText ( void  )
inline

Returns the explain text of the field (See HFloatTable class description)

Definition at line 2184 of file datalib.h.

QString HDataField::getFunction ( void  )
inline

Returns the currently actualized function of the field

See Also
setFunction()

Definition at line 2401 of file datalib.h.

int HDataField::getGColor ( void  )
inline

Returns the green component of the field's color

Definition at line 2336 of file datalib.h.

bool HDataField::getLastValidateStatus ( )
inline

Returns true if the last validation failed on this field. If the function returned true the field pass the validation.

See Also
setValidator()
lowerValidate()
resetValidateStatus()

Definition at line 2542 of file datalib.h.

bool HDataField::getPermanentValidateStatus ( )
inline

Returns true if the last validation failed on this field. If the function returned true the field pass the validation. YOU CAN'T RESET THE RESULT OF THIS FUNCTION with resetValidateStatus() ! If a validation error make this function to return true, it will only return false again if the field gets a new value which pass the validation!

See Also
setValidator()
lowerValidate()

Definition at line 2554 of file datalib.h.

int HDataField::getPrintCellWidth ( void  )
inline

Returns the width of the cell in print and print preview (0 means automatic, this is the default)

Definition at line 2425 of file datalib.h.

int HDataField::getRColor ( void  )
inline

Returns the red component of the field's color

Definition at line 2334 of file datalib.h.

QString HDataField::getSpecDisplaySortMode ( void  )
inline

Gets the special sorting mode of the field

See Also
setSpecDisplaySortMode()

Definition at line 2208 of file datalib.h.

QString HDataField::getSQLValue ( void  )
virtual

Returns the value of the field in that format which accepted by the sql database.

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5408 of file datalib.cpp.

QString HDataField::getSQLValueAsString ( void  )
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 in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5413 of file datalib.cpp.

QString HDataField::getSubselect ( void  )
inline

Returns the currently actualized subselect of the field

See Also
setSubselect()

Definition at line 2420 of file datalib.h.

QString HDataField::getTailText ( void  )
inline

Returns the tail text of the field (See HFloatTable class description)

Definition at line 2188 of file datalib.h.

QString HDataField::getTitleText ( void  )
inline

Returns the title text of the field (See HFloatTable class description)

Definition at line 2186 of file datalib.h.

QVariant HDataField::getValue ( void  )
virtual

Returns the value of the field.

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5418 of file datalib.cpp.

bool HDataField::hasMark ( QString  mark)

Returns true if the field have that marker given as parameter, otherwise false.

See Also
addMark()

Definition at line 5472 of file datalib.cpp.

bool HDataField::isEditable ( void  )
inline

Returns true if the field is editable, false if readonly.

See Also
setEditable()
setReadonly()

Definition at line 2274 of file datalib.h.

bool HDataField::isGuienabled ( void  )
inline

Returns true if the guiedabled attribute is true

See Also
setGuienabled()
setGuidisabled()

Definition at line 2286 of file datalib.h.

bool HDataField::isLogged ( void  )
inline

Returns true if the field to log the changes on sql database

See Also
setLogging()
resetLogging()

Definition at line 2321 of file datalib.h.

bool HDataField::isMeldedWithNext ( void  )
inline

Returns true if the meldwithnext attribute is set.

See Also
meldWithNext()

Definition at line 2360 of file datalib.h.

bool HDataField::isNoMiddleStretch ( void  )
inline

Returns true if the nomiddlestretch attribute is set.

See Also
noMiddleStretch()

Definition at line 2374 of file datalib.h.

bool HDataField::isPrintCellWrap ( void  )
inline

Returns true if the text of the cell can be wrapped in print and print preview, otherwise false

Definition at line 2432 of file datalib.h.

bool HDataField::isReallyChanged ( void  )

Returns true if the value is changed according to the sql database value. The normal isSet() function have already returns true that case the user changed the value to something else and set back to the original. But this function compares the readed sql value with the current, this means that this function always returns the effective changing status.

Definition at line 5589 of file datalib.cpp.

bool HDataField::isSet ( void  )
inline

Returns true if the field value is modified, otherwise false *

See Also
notSet()
doSet()

Definition at line 2282 of file datalib.h.

bool HDataField::isShow ( void  )
inline

Returns true if the field is appear in gui and other places, returns false if hided

See Also
setShow()
setHide()

Definition at line 2278 of file datalib.h.

bool HDataField::isSQLField ( void  )
inline

Returns true if the field is a sql database dependent field

Definition at line 2270 of file datalib.h.

virtual QString HDataField::lowerValidate ( void  )
inlinevirtual

Subtype (descendant) specific validation. (In HDataField this function does nothing) Descendants can be redefine this function to handle their validations.

Returns
it returns an empty string if the value passed, otherwise the error string

Reimplemented in HFloating, and HNumber.

Definition at line 2482 of file datalib.h.

void HDataField::meldWithNext ( void  )
inline

Sets the meldwithnext attribute to true. It is actualized in gui in HDispTable: If this attrubute is true this datafield will be melded to the next, so they will appear in one line. Useful if you would like to place more value editor in one line, which can be the three color components integer for example. Otherwise all field will be appear separated line.

See Also
noMiddleStretch()
resetMeldWithNext()
isMeldedWithNext()

Definition at line 2354 of file datalib.h.

void HDataField::noMiddleStretch ( void  )
inline

Sets the nomiddlestretch attribute to true. It is actualized in gui in HDispTable: The gui don't put stretch between the explain text and the value editor. Can be useful that cases when we have melded fields.

See Also
meldWithNext()
resetNoMiddleStretch()
isNoMiddleStretch()

Definition at line 2368 of file datalib.h.

void HDataField::notSet ( void  )
inline

Sets the field's modified status to not modified!

See Also
isSet()

Definition at line 2308 of file datalib.h.

void HDataField::resetFunction ( void  )
inline

Resets the function attrubute of the field

See Also
setFunction()

Definition at line 2398 of file datalib.h.

void HDataField::resetLogging ( void  )
inline

Clears the field to log the changes on sql database

See Also
isLogged()

Definition at line 2317 of file datalib.h.

void HDataField::resetMeldWithNext ( void  )
inline

Sets the meldwithnext attribute to false.

See Also
meldWithNext()

Definition at line 2357 of file datalib.h.

void HDataField::resetNoMiddleStretch ( void  )
inline

Sets the nomiddlestretch attribute to false.

See Also
noMiddleStretch()

Definition at line 2371 of file datalib.h.

void HDataField::resetSubselect ( void  )
inline

Resets the subselect attribute of the field

See Also
setSubselect()

Definition at line 2417 of file datalib.h.

void HDataField::resetValidateStatus ( )
inline

Clears the result of the last validation returned by getLastValidateStatus() . (Gui classes calls this function after queries the status)

See Also
getLastValidateStatus()

Definition at line 2546 of file datalib.h.

int HDataField::returnToDefault ( void  )

Sets the value of the data field to the default.

Definition at line 5314 of file datalib.cpp.

void HDataField::setColor ( int  r,
int  g,
int  b 
)

Sets the color of the field (appear in gui)

Parameters
rred component value 0-255
ggreen component value 0-255
bblue component value 0-255

Definition at line 5383 of file datalib.cpp.

void HDataField::setData ( QString  _sqlColumn,
QString  _explain,
QString  tit,
QString  _tailstr = "",
bool  _editable = true 
)

Sets some base data

Parameters
_sqlColumnsets the sqlColumn attribute
_explainsets the explain text of the field
titsets the title text of the field
_tailstrsets the tail text of the field
_editablesets the editable attribute of the field

Definition at line 5373 of file datalib.cpp.

int HDataField::setDefval ( QVariant  v)
virtual

Sets the default value of the field.

Returns
0 if success.

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5401 of file datalib.cpp.

void HDataField::setEditable ( void  )

Sets the field to editable (Removes readonly attribute)

See Also
isEditable()

Definition at line 5443 of file datalib.cpp.

void HDataField::setEditBoxMaxWidth ( int  max)
inline

Sets the maximum width of the QLineEdit boxes when the field is edited in a HDispTable. If the value is 0 then the maximum is not specified. (This attribute only works on that kind of fields which are edited with QLineEdit)

Definition at line 2379 of file datalib.h.

void HDataField::setExplainText ( QString  expl)

Sets the explain text of the field. It does not change/refresh the already builded gui components! (See HFloatTable class description)

Definition at line 5228 of file datalib.cpp.

void HDataField::setFunction ( QString  func)

Sets an sql function to this data field. When an sql query executed, the value of this field is queried with this function. Fox example you set "date" as function and this field is a "timestamp" named timestamp field then the sql select queries the value this way: date(timestamp)
THIS ONLY WORKS IF THE FIELD IS READ ONLY. (Because it can be conflict if you would like to re-store this converted value)
Currently the following typed fiels accept this function: HSmallText,HLargeText,HNumber,HFloating,HDate
The accesibility of this function is signed by the acceptFunction() function.

Definition at line 5214 of file datalib.cpp.

void HDataField::setGuidisabled ( void  )
inline

Sets the guienabled attribute to false (Gui editor is disabled)

See Also
isGuienabled()

Definition at line 2305 of file datalib.h.

void HDataField::setGuienabled ( void  )
inline

Sets the guienabled attribute to true (Gui editor is enabled)

See Also
isGuienabled()

Definition at line 2302 of file datalib.h.

void HDataField::setHide ( void  )
inline

Sets the filed to hide (don't appar in gui,print list,xml etc...)

See Also
isShow()

Definition at line 2299 of file datalib.h.

void HDataField::setLogging ( void  )
inline

Sets the field to log the data changes on sql database

See Also
isLogged()

Definition at line 2314 of file datalib.h.

void HDataField::setMaulallyValidateError ( QString  message)

You can set an external validate error manually with this function. Useful to handle checks according to the buisniss logics, or do other non sql or sintax check. If you set an error with this function, the gui subsystem will sing the error to the user.

Parameters
messagethe validate error mesage

Definition at line 5206 of file datalib.cpp.

void HDataField::setNotValidValues ( QStringList  nvl)

Sets more disabled value If the user modified a value which match with one of this disabled values the validation reject the modification.

Definition at line 5190 of file datalib.cpp.

void HDataField::setPrintCellNoWrap ( void  )
inline

Sets that the text of the cell cannot wrapped in print and print preview

Definition at line 2430 of file datalib.h.

void HDataField::setPrintCellWidth ( int  w)
inline

Sets the width of the cell in print and print preview (0 means automatic, this is the default)

Definition at line 2423 of file datalib.h.

void HDataField::setPrintCellWrap ( void  )
inline

Sets that the text of the cell can be wrapped in print and print preview

Definition at line 2428 of file datalib.h.

void HDataField::setReadonly ( void  )

Sets the filed to readonly

See Also
isEditable()

Definition at line 5448 of file datalib.cpp.

void HDataField::setShow ( void  )
inline

Sets the field to show (removes the hide attribute)

See Also
isShow()

Definition at line 2296 of file datalib.h.

void HDataField::setSpecDisplaySortMode ( QString  m)
inline

Sets a special sorting mode from this field. This sorting mode is only apply in gui lists Now only can receive one modifier: "dropchar" which means the characters are dropped from the value and the result converted to integer, then the result is sorted.
(For example if the sorted values are: id_1,id_10,id_14,id_2,id_21 will be 1,2,10,14,21

Definition at line 2205 of file datalib.h.

void HDataField::setSubselect ( QString  subs)

Set a subselect to this field, instead read a simple sql value. When an sql query executed, the value is queried with the subselect which set here.
For example "select date(now())" -> SELECT field1,field2,(select date(now())),field4,... FROM ...
THIS ONLY WORKS IF THE FIELD IS READ ONLY. (Because it can be conflict if you would like to re-store this queried value)
Currently the following typed fiels accept this function: HSmallText,HLargeText,HNumber,HFloating,HDate
The accesibility of this function is signed by the acceptSubselect() function.

Definition at line 5246 of file datalib.cpp.

void HDataField::setTailText ( QString  tail)

Sets the tail text of the field. It does not change/refresh the already builded gui components! (See HFloatTable class description)

Definition at line 5240 of file datalib.cpp.

void HDataField::setTitleText ( QString  titl)

Sets the title text of the field. It does not change/refresh the already builded gui components! (See HFloatTable class description)

Definition at line 5234 of file datalib.cpp.

void HDataField::setValidator ( QString  v = "")

Sets a regex to validate the field. If the modified value does not match with this regex, the gSAFE will drop an error signal and recejt the modifications. You can add more specific validations in the descendants too with the lowerValidate() function.
The HDispTable will be sing the problematic element to the user. This works automatically.

Definition at line 5185 of file datalib.cpp.

int HDataField::setValue ( QVariant  v,
bool  sdisabled = false 
)
virtual

Sets the value of the field.

Parameters
sdisabledif this parameter is true the dataChanged() signal is disabled
Returns
0 if success.

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5390 of file datalib.cpp.

QString HDataField::sqlCreateStringPart ( QString  switches = "")
virtual

Returns the part of the CREATE TABLE sql command which creates this field

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5453 of file datalib.cpp.

QString HDataField::sqlInsertHead ( void  )
virtual

Returns the sql name of the field (in insert) This function can be redefined in descendats!

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5423 of file datalib.cpp.

QString HDataField::sqlInsertValue ( void  )
virtual

Returns the sql value of the field (in insert) This function can be redefined in descendats!

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5428 of file datalib.cpp.

QString HDataField::sqlSelectHead ( void  )
virtual

Returns the sql name of the field (in select) This function can be redefined in descendats!

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5438 of file datalib.cpp.

void HDataField::sqlSynced ( HDataChangeLogger dclog = NULL,
bool  forcechange = false,
bool  forcelog = false 
)

Do not call this function unless you exactly know, what you want!
It sets the values of valueInSql and sync_valueInSql attributes. This function is automatically called whenewer it needs. It is signs, that the value is just syncrinized with the sql database. (Actually the HTable calls this function every time when the data is refreshed from the sql) It handles the logging too.

Parameters
dclogthe Logger object. The function can palce the log messages into this object.
forcechangethe event is accepted as changing whenever the sync_valueInSql is false.
forcelogthe changing is logged whenever the logging attribute is false.
See Also
clearSqlSynced()
isReallyChanged()

Definition at line 5565 of file datalib.cpp.

QString HDataField::sqlUpdate ( void  )
virtual

Returns the sql update part of the field ( name='VALUE' ) This function can be redefined in descendats!

Reimplemented in HSqlChoose, HTimestamp, HDate, HFloating, HCheck, HStatic, HNumber, HNumHash, HCharHash, HLargeText, HSmallText, HConnect, and HKey.

Definition at line 5433 of file datalib.cpp.

void HDataField::updateStaticDisplayElementsSignal ( void  )
signal

Emitted when the object's static data changed. This can be the explain text, title text, tail text. The gui will refresh the changed static data.

void HDataField::useRole ( QString  name)

Apply the parameter named role on this data field. If you pass rolename which does not appear here, it does nothing. A single role can set:

  • Show/Hide attribute
  • Editable/Readonly attribute
  • Guienable/Guidisable attribute
  • Reset the value to default
  • Set a role specified default value
See Also
HDataFieldRole

Definition at line 5514 of file datalib.cpp.

QString HDataField::validate ( void  )

Validate the field.

See Also
setValidator()

Definition at line 5260 of file datalib.cpp.

void HDataField::value_changed ( )
virtual

You can sing that the value is changed with this function. Calls resetValidateStatus() This function can be redefined in descendats!

Definition at line 5368 of file datalib.cpp.

Member Data Documentation

int HDataField::color_r
protected

The color of the gui part

Definition at line 2121 of file datalib.h.

QString HDataField::conn_sqlTable

This field belong to the "conn_sqlTable" named sql table. By default this value is empty because the HTable contains this data, but if this field is a connected table this attribute will store the tablename.

Definition at line 2145 of file datalib.h.

bool HDataField::connected

If this table is connected to an another this attribute will be true automatically

Definition at line 2141 of file datalib.h.

QString HDataField::defval
protected

The default value of the field

Definition at line 2085 of file datalib.h.

QString HDataField::derived
protected

In case of query this part is called in brackets

Definition at line 2093 of file datalib.h.

bool HDataField::editable
protected

True if the field is editable

Definition at line 2109 of file datalib.h.

int HDataField::editboxmaxwidth
protected

in HDispTable: specify the maximum width of the edit area

Definition at line 2099 of file datalib.h.

QString HDataField::explain
protected

The long name/explain text of the field

Definition at line 2077 of file datalib.h.

QString HDataField::function
protected

If the value of the field have to put in a function, for example: date(timestamp)

Definition at line 2091 of file datalib.h.

bool HDataField::guienabled
protected

True if the data field's gui editor is enabled (default)

Definition at line 2115 of file datalib.h.

bool HDataField::logged
protected

If this field is true the changing of this value is logged (default:false)

Definition at line 2129 of file datalib.h.

QStringList HDataField::markers
protected

Markers of the field (See HTableBase to understand markers)

Definition at line 2124 of file datalib.h.

bool HDataField::meldwithnext
protected

in HDispTable: If true the next datafield will be melded to one line with this.

Definition at line 2095 of file datalib.h.

bool HDataField::nomiddlestretch
protected

in HDispTable: Don't put stretch expander between the QLabel (expain text) and the value editor widget

Definition at line 2097 of file datalib.h.

QStringList HDataField::notvalid
protected

List of not allowed values.

Definition at line 2089 of file datalib.h.

QList<HDataFieldRole> HDataField::roles
protected

Contains the roles of the field

Definition at line 2126 of file datalib.h.

int HDataField::set
protected

Sign if the field is modified, or not

Definition at line 2075 of file datalib.h.

bool HDataField::show
protected

True if the field is showed in the gui, printigs, etc

Definition at line 2113 of file datalib.h.

QString HDataField::spec_disp_sort
protected

Special display sort

Definition at line 2102 of file datalib.h.

bool HDataField::sql
protected

True if the field is sql related

Definition at line 2111 of file datalib.h.

QString HDataField::sqlColumn
protected

The name of the field in sql database (column name)

Definition at line 2083 of file datalib.h.

bool HDataField::sync_valueInSql
protected

This attribute is true if the valueInSql attribute contains valid value (valueInSql is set)

Definition at line 2132 of file datalib.h.

QString HDataField::tailstr
protected

Text appended after the value ( for example: USD,Hour,Meter,etc... )

Definition at line 2081 of file datalib.h.

QString HDataField::title
protected

The brief name of the field (header in tables)

Definition at line 2079 of file datalib.h.

QString HDataField::valid
protected

A validator regex

Definition at line 2087 of file datalib.h.

QString HDataField::valueInSql
protected

Contains the value which stored in sql database. This value is not valid everytime. If the HDataField is just created the HDataField does not have any information about the sql value, so this field is not valid. This fact is represented with the sync_valueInSql attribute. IF this attribute (valueInSql) is valid it contains a getSQLValueAsString()

Definition at line 2137 of file datalib.h.


The documentation for this class was generated from the following files: