Table Class Reference

#include <Table.h>

Inheritance diagram for Table:

MyWidget scripted TableStatistics

List of all members.


Detailed Description

MDI window providing a spreadsheet table with column logic.

Future Plans

Port to the Model/View approach used in Qt4 and get rid of the Qt3Support dependancy. [ assigned to thzs ]

Public Types

enum  ColType {
  Numeric = 0, Text = 1, Date = 2, Time = 3,
  Month = 4, Day = 5
}
enum  PlotDesignation {
  All = -1, None = 0, X = 1, Y = 2,
  Z = 3, xErr = 4, yErr = 5, Label = 6
}

Public Slots

bool calculate ()
 Compute selected cells from column formulae; use current cell if there's no selection.
bool calculate (int col, int startRow, int endRow)
 Compute specified cells from column formula.
double cell (int row, int col)
 Return the value of the cell as a double.
void cellEdited (int, int col)
void changeColWidth (int width, int col)
void changeColWidth (int width, bool allCols)
void clearCell (int row, int col)
QVarLengthArray< double > col (int ycol)
QString colComment (int col)
QStringList colComments ()
int colIndex (const QString &name)
QString colLabel (int col)
QString colName (int col)
QStringList colNames ()
int colPlotDesignation (int col)
QString columnFormat (int col)
void columnNumericFormat (int col, int *f, int *precision)
void columnNumericFormat (int col, char *f, int *precision)
QStringList columnsList ()
int columnType (int col)
Q3ValueList< int > columnTypes ()
int columnWidth (int col)
QStringList columnWidths ()
void colWidthModified (int, int, int)
 Notifies the main application that the width of a table column has been modified by the user.
int colX (int col)
int colY (int col)
bool commentsEnabled ()
void copy (Table *m)
QStringList drawableColumnSelection ()
bool exportASCII (const QString &fname, const QString &separator, bool withLabels=false, bool exportComments=false, bool exportSelection=false)
void exportPDF (const QString &fileName)
int firstSelectedColumn ()
int firstXCol ()
void freeMemory ()
QStringList getColumnsFormat ()
QStringList getCommands ()
void goToRow (int row)
 Scroll to row (row starts with 1).
void importASCII (const QString &fname, const QString &sep, int ignoredLines, bool renameCols, bool stripSpaces, bool simplifySpaces, bool importComments, bool newTable, const QString &commentString, bool readOnly=false)
void importMultipleASCIIFiles (const QString &fname, const QString &sep, int ignoredLines, bool renameCols, bool stripSpaces, bool simplifySpaces, bool importComments, const QString &commentString, bool readOnly, int importFileAs)
void init (int rows, int cols)
bool isColumnSelected (int col, bool full=false)
bool isEmptyColumn (int col)
bool isEmptyRow (int row)
bool isReadOnlyColumn (int col)
bool isRowSelected (int row, bool full=false)
void loadHeader (QStringList header)
void moveCurrentCell ()
int nonEmptyRows ()
void notifyChanges ()
 This slot notifies the main application that the table has been modified. Triggers the update of 2D plots.
bool noXColumn ()
bool noYColumn ()
int numCols ()
int numRows ()
int numSelectedRows ()
Q3ValueList< int > plotDesignations ()
void print (const QString &fileName)
void print ()
void resizeCols (int)
void resizeRows (int)
void restore (const QStringList &lst)
 Not implemented yet.
QString saveAsTemplate (const QString &geometryInfo)
QString saveText ()
void saveToMemory ()
void saveToMemory (double **cells)
int selectedColsNumber ()
int selectedColumn ()
QStringList selectedColumns ()
QStringList selectedErrColumns ()
QStringList selectedYColumns ()
QStringList selectedYLabels ()
void setAscValues ()
void setBackgroundColor (const QColor &col)
void setCell (int row, int col, double val)
void setColComment (int col, const QString &s)
void setColComments (const QStringList &lst)
void setColName (int col, const QString &text, bool enumerateRight=false)
void setColNumericFormat (int f, int prec, int col, bool updateCells=true)
void setColPlotDesignation (int col, PlotDesignation pd)
void setColumnsFormat (const QStringList &lst)
void setColumnType (int col, ColType val)
void setColumnTypes (const QStringList &ctl)
void setColumnTypes (Q3ValueList< int > ctl)
void setColWidths (const QStringList &widths)
void setCommand (int col, const QString &com)
 Set formula for column col.
void setCommands (const QString &com)
 Set all column formulae.
void setCommands (const QStringList &com)
 Set all column formulae.
bool setDateFormat (const QString &format, int col, bool updateCells=true)
void setDayFormat (const QString &format, int col, bool updateCells=true)
void setHeader (QStringList header)
void setHeaderColor (const QColor &col)
void setHeaderColType ()
void setHeaderFont (const QFont &fnt)
void setMonthFormat (const QString &format, int col, bool updateCells=true)
void setNumCols (int cols)
void setNumRows (int rows)
void setPlotDesignation (PlotDesignation pd, bool rightColumns=false)
void setRandomValues ()
void setReadOnlyColumn (int col, bool on=true)
void setSelectedCol (int col)
void setText (int row, int col, const QString &text)
void setTextColor (const QColor &col)
void setTextFont (const QFont &fnt)
void setTextFormat (int col)
bool setTimeFormat (const QString &format, int col, bool updateCells=true)
void showComments (bool on=true)
MyTabletable ()
QString text (int row, int col)
int verticalHeaderWidth ()
QStringList YColumns ()
Column Operations
void addCol (PlotDesignation pd=Y)
void addColumns (int c, bool readOnly=false)
void clearCol ()
void insertCol ()
void insertCols (int start, int count)
void moveColumn (int, int, int)
void moveColumnBy (int cols)
void removeCol (const QStringList &list)
void removeCol ()
void swapColumns (int, int)
void clear ()
void clearSelection ()
void copySelection ()
void cutSelection ()
 Selection Operations.
void deselect ()
void pasteSelection ()
void selectAllTable ()
Event Handlers
void contextMenuEvent (QContextMenuEvent *e)
void customEvent (QEvent *e)
bool eventFilter (QObject *object, QEvent *e)
 Filters other object's events (customizes title bar's context menu).
Row Operations
void deleteRows (int startRow, int endRow)
void deleteSelectedRows ()
void insertRow ()
Saving and Restoring
QString & getNewSpecifications ()
QString & getSpecifications ()
QString newCaption ()
QString oldCaption ()
void restore (QString &spec)
QString saveColumnTypes ()
QString saveColumnWidths ()
QString saveCommands ()
QString saveComments ()
QString saveHeader ()
QString saveReadOnlyInfo ()
virtual QString saveToString (const QString &geometry, bool=false)
void setNewSpecifications ()
void setSpecifications (const QString &s)
Normalization
void normalize ()
void normalizeCol (int col=-1)
void normalizeSelection ()
Sorting
void sort (int type=0, int order=0, const QString &leadCol=QString())
 Sort all columns as in sortColumns(const QStringList&,int,int,const QString&).
void sortColAsc ()
 Sort the current column in ascending order.
void sortColDesc ()
 Sort the current column in descending order.
void sortColumn (int col=-1, int order=0)
 Sort the specified column.
void sortColumns (const QStringList &cols, int type=0, int order=0, const QString &leadCol=QString())
 Sort the specified columns.
void sortColumns (int type=0, int order=0, const QString &leadCol=QString())
 Sort selected columns as in sortColumns(const QStringList&,int,int,const QString&).
void sortColumnsDialog ()
 Display a dialog with some options for sorting the selected columns.
void sortTableDialog ()
 Display a dialog with some options for sorting all columns.

Signals

void changedColHeader (const QString &, const QString &)
void colValuesDialog ()
void createTable (const QString &, int, int, const QString &)
void modifiedData (Table *, const QString &)
void optionsDialog ()
void removedCol (const QString &)
void resizedTable (QWidget *)
void showContextMenu (bool selection)

Public Member Functions

Q3TableSelection getSelection ()
void resetHeader ()
void setNumericPrecision (int prec)
 Sets the number of significant digits.
 Table (ScriptingEnv *env, int r, int c, const QString &label, QWidget *parent=0, const QString &name=QString(), Qt::WFlags f=0)
 Table (ScriptingEnv *env, const QString &fname, const QString &sep, int ignoredLines, bool renameCols, bool stripSpaces, bool simplifySpaces, bool importComments, const QString &commentString, bool readOnly, const QString &label, QWidget *parent=0, const QString &name=QString(), Qt::WFlags f=0)
void updateDecimalSeparators (const QLocale &oldSeparators)
 Updates the decimal separators when importing ASCII files on user request.
void updateDecimalSeparators ()
 Updates the decimal separators in the numerical columns on user request.

Protected Attributes

MyTabled_table

Private Member Functions

void setColumnHeader (int index, const QString &label)
 Internal function to change the column header.

Private Attributes

QStringList col_format
QStringList col_label
QList< int > col_plot_type
QList< int > colTypes
QStringList commands
QStringList comments
int d_numeric_precision
QList< bool > d_read_only
double ** d_saved_cells
bool d_show_comments
QString newSpecifications
int selectedCol
QString specifications

Member Enumeration Documentation

enum Table::ColType

Enumerator:
Numeric 
Text 
Date 
Time 
Month 
Day 

enum Table::PlotDesignation

Enumerator:
All 
None 
X 
Y 
Z 
xErr 
yErr 
Label  caption detemined by the window label


Constructor & Destructor Documentation

Table::Table ( ScriptingEnv env,
const QString &  fname,
const QString &  sep,
int  ignoredLines,
bool  renameCols,
bool  stripSpaces,
bool  simplifySpaces,
bool  importComments,
const QString &  commentString,
bool  readOnly,
const QString &  label,
QWidget *  parent = 0,
const QString &  name = QString(),
Qt::WFlags  f = 0 
)

Table::Table ( ScriptingEnv env,
int  r,
int  c,
const QString &  label,
QWidget *  parent = 0,
const QString &  name = QString(),
Qt::WFlags  f = 0 
)


Member Function Documentation

void Table::addCol ( PlotDesignation  pd = Y  )  [slot]

void Table::addColumns ( int  c,
bool  readOnly = false 
) [slot]

bool Table::calculate (  )  [slot]

Compute selected cells from column formulae; use current cell if there's no selection.

bool Table::calculate ( int  col,
int  startRow,
int  endRow 
) [slot]

Compute specified cells from column formula.

double Table::cell ( int  row,
int  col 
) [slot]

Return the value of the cell as a double.

void Table::cellEdited ( int  row,
int  col 
) [slot]

void Table::changeColWidth ( int  width,
int  col 
) [slot]

void Table::changeColWidth ( int  width,
bool  allCols 
) [slot]

void Table::changedColHeader ( const QString &  ,
const QString &   
) [signal]

void Table::clear (  )  [slot]

void Table::clearCell ( int  row,
int  col 
) [slot]

void Table::clearCol (  )  [slot]

void Table::clearSelection (  )  [slot]

QVarLengthArray< double > Table::col ( int  ycol  )  [slot]

QString Table::colComment ( int  col  )  [inline, slot]

QStringList Table::colComments (  )  [inline, slot]

int Table::colIndex ( const QString &  name  )  [slot]

QString Table::colLabel ( int  col  )  [inline, slot]

QString Table::colName ( int  col  )  [slot]

QStringList Table::colNames (  )  [inline, slot]

int Table::colPlotDesignation ( int  col  )  [inline, slot]

QString Table::columnFormat ( int  col  )  [inline, slot]

void Table::columnNumericFormat ( int  col,
int *  f,
int *  precision 
) [slot]

void Table::columnNumericFormat ( int  col,
char *  f,
int *  precision 
) [slot]

QStringList Table::columnsList (  )  [slot]

int Table::columnType ( int  col  )  [inline, slot]

Q3ValueList<int> Table::columnTypes (  )  [inline, slot]

int Table::columnWidth ( int  col  )  [slot]

QStringList Table::columnWidths (  )  [slot]

void Table::colValuesDialog (  )  [signal]

void Table::colWidthModified ( int  ,
int  ,
int   
) [slot]

Notifies the main application that the width of a table column has been modified by the user.

int Table::colX ( int  col  )  [slot]

int Table::colY ( int  col  )  [slot]

bool Table::commentsEnabled (  )  [inline, slot]

void Table::contextMenuEvent ( QContextMenuEvent *  e  )  [slot]

void Table::copy ( Table m  )  [slot]

void Table::copySelection (  )  [slot]

void Table::createTable ( const QString &  ,
int  ,
int  ,
const QString &   
) [signal]

void Table::customEvent ( QEvent *  e  )  [slot]

void Table::cutSelection (  )  [slot]

Selection Operations.

void Table::deleteRows ( int  startRow,
int  endRow 
) [slot]

void Table::deleteSelectedRows (  )  [slot]

void Table::deselect (  )  [slot]

QStringList Table::drawableColumnSelection (  )  [slot]

bool Table::eventFilter ( QObject *  object,
QEvent *  e 
) [slot]

Filters other object's events (customizes title bar's context menu).

Reimplemented from MyWidget.

bool Table::exportASCII ( const QString &  fname,
const QString &  separator,
bool  withLabels = false,
bool  exportComments = false,
bool  exportSelection = false 
) [slot]

void Table::exportPDF ( const QString &  fileName  )  [virtual, slot]

Reimplemented from MyWidget.

int Table::firstSelectedColumn (  )  [slot]

int Table::firstXCol (  )  [slot]

void Table::freeMemory (  )  [slot]

QStringList Table::getColumnsFormat (  )  [inline, slot]

QStringList Table::getCommands (  )  [inline, slot]

QString & Table::getNewSpecifications (  )  [slot]

Q3TableSelection Table::getSelection (  ) 

QString & Table::getSpecifications (  )  [slot]

void Table::goToRow ( int  row  )  [slot]

Scroll to row (row starts with 1).

void Table::importASCII ( const QString &  fname,
const QString &  sep,
int  ignoredLines,
bool  renameCols,
bool  stripSpaces,
bool  simplifySpaces,
bool  importComments,
bool  newTable,
const QString &  commentString,
bool  readOnly = false 
) [slot]

void Table::importMultipleASCIIFiles ( const QString &  fname,
const QString &  sep,
int  ignoredLines,
bool  renameCols,
bool  stripSpaces,
bool  simplifySpaces,
bool  importComments,
const QString &  commentString,
bool  readOnly,
int  importFileAs 
) [slot]

void Table::init ( int  rows,
int  cols 
) [slot]

void Table::insertCol (  )  [slot]

void Table::insertCols ( int  start,
int  count 
) [slot]

void Table::insertRow (  )  [slot]

bool Table::isColumnSelected ( int  col,
bool  full = false 
) [inline, slot]

bool Table::isEmptyColumn ( int  col  )  [slot]

bool Table::isEmptyRow ( int  row  )  [slot]

bool Table::isReadOnlyColumn ( int  col  )  [slot]

bool Table::isRowSelected ( int  row,
bool  full = false 
) [inline, slot]

void Table::loadHeader ( QStringList  header  )  [slot]

void Table::modifiedData ( Table ,
const QString &   
) [signal]

void Table::moveColumn ( int  section,
int  fromIndex,
int  toIndex 
) [slot]

void Table::moveColumnBy ( int  cols  )  [slot]

void Table::moveCurrentCell (  )  [slot]

QString Table::newCaption (  )  [slot]

used for restoring the table caption stored in new specifications string

int Table::nonEmptyRows (  )  [slot]

void Table::normalize (  )  [slot]

void Table::normalizeCol ( int  col = -1  )  [slot]

void Table::normalizeSelection (  )  [slot]

void Table::notifyChanges (  )  [slot]

This slot notifies the main application that the table has been modified. Triggers the update of 2D plots.

Reimplemented from MyWidget.

bool Table::noXColumn (  )  [slot]

bool Table::noYColumn (  )  [slot]

int Table::numCols (  )  [slot]

int Table::numRows (  )  [slot]

int Table::numSelectedRows (  )  [slot]

QString Table::oldCaption (  )  [slot]

used for restoring the table old caption stored in specifications string

void Table::optionsDialog (  )  [signal]

void Table::pasteSelection (  )  [slot]

Q3ValueList<int> Table::plotDesignations (  )  [inline, slot]

void Table::print ( const QString &  fileName  )  [slot]

void Table::print (  )  [virtual, slot]

Reimplemented from MyWidget.

void Table::removeCol ( const QStringList &  list  )  [slot]

void Table::removeCol (  )  [slot]

void Table::removedCol ( const QString &   )  [signal]

void Table::resetHeader (  ) 

void Table::resizeCols ( int  c  )  [slot]

void Table::resizedTable ( QWidget *   )  [signal]

void Table::resizeRows ( int  r  )  [slot]

void Table::restore ( const QStringList &   )  [virtual, slot]

Not implemented yet.

Reimplemented from MyWidget.

void Table::restore ( QString &  spec  )  [slot]

QString Table::saveAsTemplate ( const QString &  geometryInfo  )  [virtual, slot]

Reimplemented from MyWidget.

QString Table::saveColumnTypes (  )  [slot]

QString Table::saveColumnWidths (  )  [slot]

QString Table::saveCommands (  )  [slot]

QString Table::saveComments (  )  [slot]

QString Table::saveHeader (  )  [slot]

QString Table::saveReadOnlyInfo (  )  [slot]

QString Table::saveText (  )  [slot]

void Table::saveToMemory (  )  [slot]

void Table::saveToMemory ( double **  cells  )  [inline, slot]

QString Table::saveToString ( const QString &  geometry,
bool  saveAsTemplate = false 
) [virtual, slot]

Reimplemented from MyWidget.

Reimplemented in TableStatistics.

void Table::selectAllTable (  )  [slot]

int Table::selectedColsNumber (  )  [slot]

int Table::selectedColumn (  )  [inline, slot]

QStringList Table::selectedColumns (  )  [slot]

QStringList Table::selectedErrColumns (  )  [slot]

QStringList Table::selectedYColumns (  )  [slot]

QStringList Table::selectedYLabels (  )  [slot]

void Table::setAscValues (  )  [slot]

void Table::setBackgroundColor ( const QColor &  col  )  [slot]

void Table::setCell ( int  row,
int  col,
double  val 
) [slot]

void Table::setColComment ( int  col,
const QString &  s 
) [slot]

void Table::setColComments ( const QStringList &  lst  )  [inline, slot]

void Table::setColName ( int  col,
const QString &  text,
bool  enumerateRight = false 
) [slot]

void Table::setColNumericFormat ( int  f,
int  prec,
int  col,
bool  updateCells = true 
) [slot]

void Table::setColPlotDesignation ( int  col,
PlotDesignation  pd 
) [slot]

void Table::setColumnHeader ( int  index,
const QString &  label 
) [private]

Internal function to change the column header.

void Table::setColumnsFormat ( const QStringList &  lst  )  [slot]

void Table::setColumnType ( int  col,
ColType  val 
) [inline, slot]

void Table::setColumnTypes ( const QStringList &  ctl  )  [slot]

void Table::setColumnTypes ( Q3ValueList< int >  ctl  )  [inline, slot]

void Table::setColWidths ( const QStringList &  widths  )  [slot]

void Table::setCommand ( int  col,
const QString &  com 
) [slot]

Set formula for column col.

void Table::setCommands ( const QString &  com  )  [slot]

Set all column formulae.

void Table::setCommands ( const QStringList &  com  )  [slot]

Set all column formulae.

bool Table::setDateFormat ( const QString &  format,
int  col,
bool  updateCells = true 
) [slot]

void Table::setDayFormat ( const QString &  format,
int  col,
bool  updateCells = true 
) [slot]

void Table::setHeader ( QStringList  header  )  [slot]

void Table::setHeaderColor ( const QColor &  col  )  [slot]

void Table::setHeaderColType (  )  [slot]

void Table::setHeaderFont ( const QFont &  fnt  )  [slot]

void Table::setMonthFormat ( const QString &  format,
int  col,
bool  updateCells = true 
) [slot]

void Table::setNewSpecifications (  )  [slot]

void Table::setNumCols ( int  cols  )  [slot]

void Table::setNumericPrecision ( int  prec  ) 

Sets the number of significant digits.

void Table::setNumRows ( int  rows  )  [slot]

void Table::setPlotDesignation ( PlotDesignation  pd,
bool  rightColumns = false 
) [slot]

void Table::setRandomValues (  )  [slot]

void Table::setReadOnlyColumn ( int  col,
bool  on = true 
) [slot]

void Table::setSelectedCol ( int  col  )  [inline, slot]

void Table::setSpecifications ( const QString &  s  )  [slot]

void Table::setText ( int  row,
int  col,
const QString &  text 
) [slot]

void Table::setTextColor ( const QColor &  col  )  [slot]

void Table::setTextFont ( const QFont &  fnt  )  [slot]

void Table::setTextFormat ( int  col  )  [slot]

bool Table::setTimeFormat ( const QString &  format,
int  col,
bool  updateCells = true 
) [slot]

void Table::showComments ( bool  on = true  )  [slot]

void Table::showContextMenu ( bool  selection  )  [signal]

void Table::sort ( int  type = 0,
int  order = 0,
const QString &  leadCol = QString() 
) [slot]

Sort all columns as in sortColumns(const QStringList&,int,int,const QString&).

void Table::sortColAsc (  )  [slot]

Sort the current column in ascending order.

See also:
sortColDesc(), sortColumn(), Q3Table::currentColumn()

void Table::sortColDesc (  )  [slot]

Sort the current column in descending order.

See also:
sortColAsc(), sortColumn(), Q3Table::currentColumn()

void Table::sortColumn ( int  col = -1,
int  order = 0 
) [slot]

Sort the specified column.

Parameters:
col the column to be sorted
order 0 means ascending, anything else means descending

void Table::sortColumns ( const QStringList &  cols,
int  type = 0,
int  order = 0,
const QString &  leadCol = QString() 
) [slot]

Sort the specified columns.

Parameters:
cols the columns to be sorted
type 0 means sort individually (as in sortColumn()), anything else means together
order 0 means ascending, anything else means descending
leadCol for sorting together, the column which determines the permutation

void Table::sortColumns ( int  type = 0,
int  order = 0,
const QString &  leadCol = QString() 
) [slot]

Sort selected columns as in sortColumns(const QStringList&,int,int,const QString&).

void Table::sortColumnsDialog (  )  [slot]

Display a dialog with some options for sorting the selected columns.

The sorting itself is done using sortColumns(int,int,const QString&).

void Table::sortTableDialog (  )  [slot]

Display a dialog with some options for sorting all columns.

The sorting itself is done using sort(int,int,const QString&).

void Table::swapColumns ( int  col1,
int  col2 
) [slot]

MyTable* Table::table (  )  [inline, slot]

QString Table::text ( int  row,
int  col 
) [slot]

void Table::updateDecimalSeparators ( const QLocale &  oldSeparators  ) 

Updates the decimal separators when importing ASCII files on user request.

void Table::updateDecimalSeparators (  ) 

Updates the decimal separators in the numerical columns on user request.

int Table::verticalHeaderWidth (  )  [inline, slot]

QStringList Table::YColumns (  )  [slot]


Member Data Documentation

QStringList Table::col_format [private]

QStringList Table::col_label [private]

QList<int> Table::col_plot_type [private]

QList<int> Table::colTypes [private]

QStringList Table::commands [private]

QStringList Table::comments [private]

int Table::d_numeric_precision [private]

QList<bool> Table::d_read_only [private]

double** Table::d_saved_cells [private]

bool Table::d_show_comments [private]

MyTable* Table::d_table [protected]

QString Table::newSpecifications [private]

int Table::selectedCol [private]

QString Table::specifications [private]


The documentation for this class was generated from the following files:
Generated on Thu Feb 7 13:59:29 2008 for QtiPlot by  doxygen 1.5.4