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

#include <datalib.h>

Inheritance diagram for HPlainDataMatrix:
HBase

Public Slots

int actLine (QString key)
 
int alternateActLine (QString key)
 

Signals

void actionOnRecord (QString key)
 
void alternateActionOnRecord (QString key)
 

Public Member Functions

 HPlainDataMatrix (int col)
 
 ~HPlainDataMatrix (void)
 
void addRow (QList< QVariant > listdata, QString ctrl="")
 
void addRowStr (QList< QString > strlistdata, QString ctrl="")
 
void addRowStr (QString d1="", QString d2="", QString d3="", QString d4="", QString d5="", QString d6="", QString d7="", QString d8="", QString d9="", QString d10="", QString d11="", QString d12="", QString d13="", QString d14="", QString d15="")
 
void addRowStrCTRL (QString ctrl, QString d1="", QString d2="", QString d3="", QString d4="", QString d5="", QString d6="", QString d7="", QString d8="", QString d9="", QString d10="", QString d11="", QString d12="", QString d13="", QString d14="", QString d15="")
 
void appendHPainDataMatrix (HPlainDataMatrix *tail)
 
void clearAll ()
 
void clearData ()
 
int columnCount ()
 
QString concatenateCoulmn (int col, QString separator)
 
QList< QVariant > currentRow (void)
 
QString currentRowControl (void)
 
QList< QString > currentRowStr (void)
 
QString currentRowStr (QString separator)
 
int fieldCount ()
 
void firstRow (void)
 
QVariant getCell (int row, int col)
 
QString getCellStr (int row, int col)
 
QString getColumn (int col, QString separator)
 
int getColumnPrintMaxWidth (int col)
 
bool getColumnPrintWrap (int col)
 
QString getContentAsHtml (QString params)
 
QList< QString > getHeader (void)
 
QString getHeaderItem (int col)
 
QList< QVariant > getRow (int row)
 
QList< QString > getRowStr (int row)
 
QString getRowStr (int row, QString separator)
 
QString getTitle (void)
 
bool isEnded (void)
 
bool nextRow (void)
 
int recordCount ()
 
void removeCurrentRow (void)
 
void removeHTMLTags (bool force_all=false)
 
void replaceSameUnderCellToEmpty (int col)
 
void replaceTextInColumn (int col, QString find, QString replace, bool parts=false)
 
int rowCount ()
 
void setAppendPrependColumn (int col, QString prepend, QString append)
 
void setCell (int row, int col, QVariant vdata)
 
void setCellStr (int row, int col, QString strdata)
 
void setColumnPrintMaxWidth (int col, int m)
 
void setColumnPrintWrap (int col, bool wrap)
 
void setExtendedTitle (QString xt)
 
void setHeader (QList< QString > strlistdata)
 
void setHeader (QString d1="", QString d2="", QString d3="", QString d4="", QString d5="", QString d6="", QString d7="", QString d8="", QString d9="", QString d10="", QString d11="", QString d12="", QString d13="", QString d14="", QString d15="")
 
void setHeaderCell (int col, QString strdata)
 
void setHtmlCssText (QString css)
 
void setRowControl (int row, QString ctrl)
 
void setTitle (QString t)
 
double sumCoulmnAsDouble (int col)
 
int sumCoulmnAsInt (int col)
 
- Public Member Functions inherited from HBase
 HBase (void)
 
 ~HBase (void)
 
QString getWhoami (void)
 

Public Attributes

int keyfield
 

Additional Inherited Members

- Protected Attributes inherited from HBase
QString whoami
 

Detailed Description

HPlainDataMatrix is a class store a table (X rows and Y columns). However it is usally contains sql tables this class is not an sql related class. It is usally used as a result of a complex sql query. ( submitNResultQuery() ) With this class you can manipulate simple data tables, can make reports, printigs, xml tables or do anything with the data.

See Also
HDispPlainDataMatrix
HPlainDMD
HXmloTable

Definition at line 336 of file datalib.h.

Constructor & Destructor Documentation

HPlainDataMatrix::HPlainDataMatrix ( int  col)

Created an empty table with a specified column number

Definition at line 1356 of file datalib.cpp.

HPlainDataMatrix::~HPlainDataMatrix ( void  )

Destructor

Definition at line 1378 of file datalib.cpp.

Member Function Documentation

void HPlainDataMatrix::actionOnRecord ( QString  key)
signal

This signal is emitted when the user (left) clicked on a record (Can be emitted directly by slot actLine() )

int HPlainDataMatrix::actLine ( QString  key)
slot

Emits the actionOnRecord signal with the given parametered key. Usally the gui call this slot to emit the signal.

Definition at line 2170 of file datalib.cpp.

void HPlainDataMatrix::addRow ( QList< QVariant >  listdata,
QString  ctrl = "" 
)

Adds a new row to the end of the table.

Definition at line 1512 of file datalib.cpp.

void HPlainDataMatrix::addRowStr ( QList< QString >  strlistdata,
QString  ctrl = "" 
)

Adds a new row to the end of the table.

Definition at line 1543 of file datalib.cpp.

void HPlainDataMatrix::addRowStr ( QString  d1 = "",
QString  d2 = "",
QString  d3 = "",
QString  d4 = "",
QString  d5 = "",
QString  d6 = "",
QString  d7 = "",
QString  d8 = "",
QString  d9 = "",
QString  d10 = "",
QString  d11 = "",
QString  d12 = "",
QString  d13 = "",
QString  d14 = "",
QString  d15 = "" 
)
inline

Adds a new row to the end of the table.

Definition at line 449 of file datalib.h.

void HPlainDataMatrix::addRowStrCTRL ( QString  ctrl,
QString  d1 = "",
QString  d2 = "",
QString  d3 = "",
QString  d4 = "",
QString  d5 = "",
QString  d6 = "",
QString  d7 = "",
QString  d8 = "",
QString  d9 = "",
QString  d10 = "",
QString  d11 = "",
QString  d12 = "",
QString  d13 = "",
QString  d14 = "",
QString  d15 = "" 
)

Adds a new row to the end of the table.

Definition at line 1560 of file datalib.cpp.

void HPlainDataMatrix::alternateActionOnRecord ( QString  key)
signal

This signal is emitted when the user right clicked on a record (Can be emitted directly by slot alternateActLine() )

int HPlainDataMatrix::alternateActLine ( QString  key)
slot

Emits the alternateActionOnRecord signal with the given parametered key. Usally the gui call this slot to emit the signal.

Definition at line 2176 of file datalib.cpp.

void HPlainDataMatrix::appendHPainDataMatrix ( HPlainDataMatrix tail)

Appends an external HPlainDataMatrix to this table.

Definition at line 1529 of file datalib.cpp.

void HPlainDataMatrix::clearAll ( )

Clears all data from HPlainDataMatrix. It only keeps the column count data. Erase all cell data, header, and title data.

Definition at line 1416 of file datalib.cpp.

void HPlainDataMatrix::clearData ( )

Clears all cell data from HPlainDataMatrix. It keeps the header and title data.

Definition at line 1389 of file datalib.cpp.

int HPlainDataMatrix::columnCount ( )

Returns the number of coumns

Definition at line 1431 of file datalib.cpp.

QString HPlainDataMatrix::concatenateCoulmn ( int  col,
QString  separator 
)

Returns a string which contains the concatenated values of the specified column with the specified separator

Definition at line 1907 of file datalib.cpp.

QList< QVariant > HPlainDataMatrix::currentRow ( void  )

Returns the current row by returning a list of QVariants

Definition at line 1755 of file datalib.cpp.

QString HPlainDataMatrix::currentRowControl ( void  )

Returns the control string of the current row (Control string is needed for making fancy report)

See Also
getContentAsHtml()

Definition at line 1770 of file datalib.cpp.

QList< QString > HPlainDataMatrix::currentRowStr ( void  )

Returns the current row by returning a list of QStrings (All cells are converted to QString)

Definition at line 1775 of file datalib.cpp.

QString HPlainDataMatrix::currentRowStr ( QString  separator)

Returns the current row by returning only one concatenated string with the specified separator (All cells are converted to QString)

Definition at line 1790 of file datalib.cpp.

int HPlainDataMatrix::fieldCount ( )
inline

Returns the number of fields. Same as rowCount()

Definition at line 390 of file datalib.h.

void HPlainDataMatrix::firstRow ( void  )

Sets the first row as current

Definition at line 1716 of file datalib.cpp.

QVariant HPlainDataMatrix::getCell ( int  row,
int  col 
)

Returns the content of the specified cell

Definition at line 1598 of file datalib.cpp.

QString HPlainDataMatrix::getCellStr ( int  row,
int  col 
)

Returns the content of the specified cell

Definition at line 1609 of file datalib.cpp.

QString HPlainDataMatrix::getColumn ( int  col,
QString  separator 
)

Returns a string which contains the concatenated values of the specified column with the specified separator

Definition at line 1619 of file datalib.cpp.

int HPlainDataMatrix::getColumnPrintMaxWidth ( int  col)
inline

Returns the maximum width of the specified column which is needed for printing

Definition at line 416 of file datalib.h.

bool HPlainDataMatrix::getColumnPrintWrap ( int  col)
inline

Returns wrap settings for the specified column which is needed for printing

Definition at line 412 of file datalib.h.

QString HPlainDataMatrix::getContentAsHtml ( QString  params)

It generates a html output from the object. Makes a report from the table. The params parameter can contains the combinations of the following flags/attributes/modifiers:

  • "html" - Put the "html" toplevel node.
  • "css" - Put the htmlcss text as css part to the html. See setHtmlCssText()
  • "center" - Makes the whole content to center aligned.
  • "notitle" - Don't write the title of the data.
  • "width=X" - The width attribute of the html table header items
  • "border=X" - The border attribute of the html table
  • "pad=X" - The cellpadding attribute of the html table
  • "space=X" - The cellspacing attribute of the html table
  • "notable" - Don't create the "table" html node. (Useful to build only table parts)
  • "noheader" - Don't generate the header for the html table. (Useful to build only table parts)
  • "fullwidth" - The width attribute of the html table. (Not the header items)

The control string in rows can contains the combinations of flags/attributes/modifiers:

  • "backgroundColor=RRGGBB" - Sets the bgcolor attribute of the "tr" node (One tr tag correspond to one row in data table)
  • "1cellexpandcenter" - "colspan" the first cell to the all table width.
  • "precell=XXX;" - Prepend the XXX text to every cell text.
  • "postcell=XXX;" - Append the XXX text to every cell text.
  • "expandCol=COLFROM-COLTO" - Colspan the COLFROM column to COLTO column. (You can use more then one)
  • "alignCellRight=COL" - Align the cell content to right in column COL ("td")
  • "alignCellCenter=COL" - Align the cell content to center in column COL ("td")
  • "addCellParam=COl:XXXX;" - Define any other attribute for the cell ("td") (For example: addCellParam=2:nowrap="nowrap"; )

Definition at line 1960 of file datalib.cpp.

QList< QString > HPlainDataMatrix::getHeader ( void  )

Returns the whole table header

Definition at line 1500 of file datalib.cpp.

QString HPlainDataMatrix::getHeaderItem ( int  col)

Returns the specified header text

Definition at line 1495 of file datalib.cpp.

QList< QVariant > HPlainDataMatrix::getRow ( int  row)

Returns the specified row

Definition at line 1672 of file datalib.cpp.

QList< QString > HPlainDataMatrix::getRowStr ( int  row)

Returns the specified row

Definition at line 1687 of file datalib.cpp.

QString HPlainDataMatrix::getRowStr ( int  row,
QString  separator 
)

Returns the specified row in one concatenated string with the specified separator (All cells are converted to QString)

Definition at line 1702 of file datalib.cpp.

QString HPlainDataMatrix::getTitle ( void  )
inline

Returns the title of the table

Definition at line 366 of file datalib.h.

bool HPlainDataMatrix::isEnded ( void  )

Check if there is next row

Definition at line 1736 of file datalib.cpp.

bool HPlainDataMatrix::nextRow ( void  )

Makes the next row as current

Definition at line 1722 of file datalib.cpp.

int HPlainDataMatrix::recordCount ( )
inline

Returns the number of records in the table. Same as rowCount()

Definition at line 388 of file datalib.h.

void HPlainDataMatrix::removeCurrentRow ( void  )

Removes the current row from the table

Definition at line 1743 of file datalib.cpp.

void HPlainDataMatrix::removeHTMLTags ( bool  force_all = false)

Removes every html tags <*> from the data cells if the control string contains : "optionalhtmltags". If the force_all is true it removes every even if the "optionalhtmltags" is missing.

Definition at line 1926 of file datalib.cpp.

void HPlainDataMatrix::replaceSameUnderCellToEmpty ( int  col)

Run down on the specified column row by row, and if found more cells with same text, it's only keep the first occurance. The other cells contains same text will be replaced an empty string

Definition at line 1834 of file datalib.cpp.

void HPlainDataMatrix::replaceTextInColumn ( int  col,
QString  find,
QString  replace,
bool  parts = false 
)

Do an ordinary find & replace process in the texts of cells but only in the specified column. If the parts parameter is false it is only replace in case of full cell matching.

Definition at line 1804 of file datalib.cpp.

int HPlainDataMatrix::rowCount ( )

Returns the number of rows

Definition at line 1436 of file datalib.cpp.

void HPlainDataMatrix::setAppendPrependColumn ( int  col,
QString  prepend,
QString  append 
)

Appends and prepends the specified string to every cell of the specified column

Definition at line 1853 of file datalib.cpp.

void HPlainDataMatrix::setCell ( int  row,
int  col,
QVariant  vdata 
)

Sets the content of the specified cell

Definition at line 1642 of file datalib.cpp.

void HPlainDataMatrix::setCellStr ( int  row,
int  col,
QString  strdata 
)

Sets the content of the specified cell

Definition at line 1662 of file datalib.cpp.

void HPlainDataMatrix::setColumnPrintMaxWidth ( int  col,
int  m 
)
inline

Sets the maximum width of the specified column which is needed for printing

Definition at line 414 of file datalib.h.

void HPlainDataMatrix::setColumnPrintWrap ( int  col,
bool  wrap 
)
inline

Sets wrap settings for the specified column which is needed for printing

Definition at line 410 of file datalib.h.

void HPlainDataMatrix::setExtendedTitle ( QString  xt)
inline

Sets the extended title of the table

Definition at line 370 of file datalib.h.

void HPlainDataMatrix::setHeader ( QList< QString >  strlistdata)

Sets the whole table header text with a QString list

Definition at line 1448 of file datalib.cpp.

void HPlainDataMatrix::setHeader ( QString  d1 = "",
QString  d2 = "",
QString  d3 = "",
QString  d4 = "",
QString  d5 = "",
QString  d6 = "",
QString  d7 = "",
QString  d8 = "",
QString  d9 = "",
QString  d10 = "",
QString  d11 = "",
QString  d12 = "",
QString  d13 = "",
QString  d14 = "",
QString  d15 = "" 
)

Sets the whole table header text with a list of QStrings

Definition at line 1460 of file datalib.cpp.

void HPlainDataMatrix::setHeaderCell ( int  col,
QString  strdata 
)

Sets a specified table header cell text

Definition at line 1441 of file datalib.cpp.

void HPlainDataMatrix::setHtmlCssText ( QString  css)
inline

Set html css text. If you call getContentAsHtml() and you use the "css" in parameter this text is used as css definitions

Definition at line 531 of file datalib.h.

void HPlainDataMatrix::setRowControl ( int  row,
QString  ctrl 
)

Sets the control string of the specified row

Definition at line 1652 of file datalib.cpp.

void HPlainDataMatrix::setTitle ( QString  t)
inline

Sets the title of the table

Definition at line 368 of file datalib.h.

double HPlainDataMatrix::sumCoulmnAsDouble ( int  col)

Calculates the sum of the values of the specified column. (The cells have to be convertable to float)

Definition at line 1890 of file datalib.cpp.

int HPlainDataMatrix::sumCoulmnAsInt ( int  col)

Calculates the sum of the values of the specified column. (The cells have to be convertable to integer)

Definition at line 1872 of file datalib.cpp.

Member Data Documentation

int HPlainDataMatrix::keyfield

The default keyfield. Used when you put this object in HDispPlainDataMatrix. With keyfield you can specify the key of the HTableBrowser elements. This is important when the user clicks on an element. That case the "activateItem" signal will be emitted which tell the key of the activated item. This key value came from:

  • If the keyfield = -2 (default) not specified. The HDispPlainDataMatrix tell the keyfield (in parameter).
  • If the keyfield = -1 a new key will be generated, which will be the index number of the rows.
  • If the keyfield >= 0 means the keyfield indexed column will be the index.

Definition at line 362 of file datalib.h.


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