SciDAVis  1.D4
Public Types | Public Slots | Signals | Public Member Functions | Public Attributes | Protected Slots | Private Attributes
Table Class Reference

MDI window providing a spreadsheet table with column logic. More...

#include <Table.h>

Inheritance diagram for Table:
TableView scripted MyWidget TableStatistics

List of all members.

Public Types

enum  ColType {
  Numeric = 0, Text = 1, Date = 2, Time = 3,
  Month = 4, Day = 5, DateTime = 6
}

Public Slots

double cell (int row, int col)
 Return the value of the cell as a double.
void clearCell (int row, int col)
QString colComment (int col)
QStringList colComments ()
int colIndex (const QString &name)
QString colLabel (int col)
QString colName (int col)
QStringList colNames ()
SciDAVis::PlotDesignation colPlotDesignation (int col)
Columncolumn (int index) const
 Return column number 'index'.
Columncolumn (const QString &name) const
 Return the column determined by the given name.
int columnCount ()
QString columnFormat (int col)
QStringList columnsList ()
int columnType (int col)
QList< int > columnTypes ()
int columnWidth (int col)
int colX (int col)
int colY (int col)
bool commentsEnabled ()
void copy (Table *m)
void customEvent (QEvent *e)
QStringList drawableColumnSelection ()
bool exportASCII (const QString &fname, const QString &separator, bool withLabels=false, bool exportSelection=false)
void exportPDF (const QString &fileName)
int firstXCol ()
void handleChange ()
void handleColumnChange (int, int)
void handleColumnChange (int, int, int, int)
void handleColumnsAboutToBeRemoved (int, int)
void handleColumnsRemoved (int, int)
void handleRowChange ()
void importASCII (const QString &fname, const QString &sep, int ignoredLines, bool renameCols, bool stripSpaces, bool simplifySpaces, bool newTable)
void importV0x0001XXHeader (QStringList header)
void init ()
 Initialization.
bool noXColumn ()
bool noYColumn ()
int numCols ()
int numRows ()
int numSelectedRows ()
QList< int > plotDesignations ()
void print ()
void print (const QString &fileName)
bool recalculate (int col, bool only_selected_rows=true)
 Compute cells from the cell formulas.
bool recalculate ()
 Recalculate selected cells.
void restore (const QStringList &lst)
 Not implemented yet.
int rowCount ()
QString saveAsTemplate (const QString &geometryInfo)
int selectedColsNumber ()
QStringList selectedColumns ()
QStringList selectedErrColumns ()
QStringList selectedYColumns ()
QMap< int, QString > selectedYLabels ()
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)
void setColPlotDesignation (int col, SciDAVis::PlotDesignation d)
void setColumnType (int col, SciDAVis::ColumnMode mode)
void setColumnTypes (QList< int > ctl)
void setColumnTypes (const QStringList &ctl)
void setColWidths (const QStringList &widths)
void setCommand (int col, const QString &com)
 Set formula for column col.
void setCommands (const QStringList &com)
 Set all column formulae.
void setCommands (const QString &com)
 Set all column formulae.
void setHeader (QStringList header)
void setHeaderColor (const QColor &col)
void setHeaderFont (const QFont &fnt)
void setNumCols (int cols)
void setNumRows (int rows)
void setPlotDesignation (SciDAVis::PlotDesignation pd)
void setText (int row, int col, const QString &text)
void setTextColor (const QColor &col)
void setTextFont (const QFont &fnt)
QString text (int row, int col)
int verticalHeaderWidth ()
QStringList YColumns ()
Column Operations
void removeCol ()
void removeCol (const QStringList &list)
void clearCol ()
void insertCol ()
void insertCols (int start, int count)
void addCol (SciDAVis::PlotDesignation pd=SciDAVis::Y)
void addColumns (int c)
Row Operations
void deleteSelectedRows ()
void insertRow ()
void cutSelection ()
 Selection Operations.
void copySelection ()
void clearSelection ()
void pasteSelection ()
void selectAllTable ()
void deselect ()
void clear ()
Saving and Restoring
virtual QString saveToString (const QString &geometry)
void saveToDevice (QIODevice *device, const QString &geometry)
QString saveHeader ()
QString saveComments ()
QString saveCommands ()
QString saveColumnWidths ()
QString saveColumnTypes ()
- Public Slots inherited from TableView
void activateFormulaMode (bool on)
void deselectAll ()
void goToCell (int row, int col)
void goToNextColumn ()
void goToPreviousColumn ()
void handleHorizontalSectionResized (int logicalIndex, int oldSize, int newSize)
void rereadSectionSizes ()
void selectAll ()
void showControlDescriptionTab ()
void showControlFormulaTab ()
void showControlTypeTab ()
void toggleComments ()
void toggleControlTabBar ()

Signals

void aboutToRemoveCol (const QString &)
void changedColHeader (const QString &, const QString &)
void modifiedData (Table *, const QString &)
void removedCol (const QString &)
void resizedTable (QWidget *)
void showContextMenu (bool selection)

Public Member Functions

void closeEvent (QCloseEvent *)
 Close event handler.
virtual QString name ()
 Return the window name.
virtual void setBirthDate (const QString &s)
 Set the creation date.
void setCaptionPolicy (CaptionPolicy policy)
 Set the caption policy.
virtual void setName (const QString &s)
 Set the window name.
void setNumericPrecision (int prec)
 Sets the number of significant digits.
virtual void setWindowLabel (const QString &s)
 Set the window label.
 Table (ScriptingEnv *env, const QString &fname, const QString &sep, int ignoredLines, bool renameCols, bool stripSpaces, bool simplifySpaces, bool convertToNumeric, QLocale numericFormat, const QString &label, QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
 Table (ScriptingEnv *env, int r, int c, const QString &label, QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
virtual QString windowLabel ()
 Return the window label.
- Public Member Functions inherited from TableView
bool areCommentsShown () const
 Return whether comments are show currently.
int columnWidth (int col) const
bool formulaModeActive () const
bool isControlTabBarVisible ()
void setColumnWidth (int col, int width)
void showComments (bool on=true)
 Show or hide (if on = false) the column comments.
 TableView (future::Table *table)
 Constructor.
virtual ~TableView ()
 Destructor.
int selectedColumnCount (bool full=false)
 Return how many columns are selected.
int selectedColumnCount (SciDAVis::PlotDesignation pd)
 Return how many columns with the given plot designation are (at least partly) selected.
bool isColumnSelected (int col, bool full=false)
 Returns true if column 'col' is selected; otherwise false.
QList< Column * > selectedColumns (bool full=false)
 Return all selected columns.
int selectedRowCount (bool full=false)
 Return how many rows are (at least partly) selected.
bool isRowSelected (int row, bool full=false)
 Returns true if row 'row' is selected; otherwise false.
int firstSelectedColumn (bool full=false)
 Return the index of the first selected column.
int lastSelectedColumn (bool full=false)
 Return the index of the last selected column.
int firstSelectedRow (bool full=false)
 Return the index of the first selected row.
int lastSelectedRow (bool full=false)
 Return the index of the last selected row.
IntervalAttribute< bool > selectedRows (bool full=false)
 Get the complete set of selected rows.
bool isCellSelected (int row, int col)
 Return whether a cell is selected.
void setCellSelected (int row, int col, bool select=true)
 Select/Deselect a cell.
void setCellsSelected (int first_row, int first_col, int last_row, int last_col, bool select=true)
 Select/Deselect a range of cells.
void getCurrentCell (int *row, int *col)
 Determine the current cell (-1 if no cell is designated as the current)
- Public Member Functions inherited from MyWidget
void askOnCloseEvent (bool ask)
 Toggle the "ask on close" flag.
QString aspect ()
 Return the window status as a string.
virtual QString birthDate ()
 Return the creation date.
virtual CaptionPolicy captionPolicy ()
 Return the caption policy.
Folderfolder ()
 Returns the pointer to the parent folder of the window.
 MyWidget (const QString &label=QString(), QWidget *parent=0, const QString name=0, Qt::WFlags f=0)
 Constructor.
void notifyChanges ()
 Notifies the main application that the window has been modified.
void setFolder (Folder *f)
 Initializes the pointer to the parent folder of the window.
virtual void setHidden ()
 Notifies that a window was hidden by a direct user action.
void setMaximized ()
void setMinimized ()
void setNormal ()
void setStatus (Status s)
 Set the window status flag (hidden, normal, minimized or maximized)
Status status ()
 Return the window status flag (hidden, normal, minimized or maximized)
- Public Member Functions inherited from scripted
 scripted (ScriptingEnv *env)
void scriptingChangeEvent (ScriptingChangeEvent *)
 ~scripted ()

Public Attributes

future::Tabled_future_table

Protected Slots

void addFunction ()
void addReference ()
void applyFormula ()
void handleAspectDescriptionAboutToChange (const AbstractAspect *aspect)
void handleAspectDescriptionChange (const AbstractAspect *aspect)
void updateFunctionDoc ()
- Protected Slots inherited from TableView
void advanceCell ()
 Advance current cell after [Return] or [Enter] was pressed.
void applyDescription ()
void applyType ()
void currentColumnChanged (const QModelIndex &current, const QModelIndex &previous)
void handleAspectAboutToBeRemoved (const AbstractAspect *aspect, int index)
void handleAspectAdded (const AbstractAspect *aspect)
void handleAspectDescriptionChanged (const AbstractAspect *aspect)
void handleFormatLineEditChange ()
void handleHeaderDataChanged (Qt::Orientation orientation, int first, int last)
void handleHorizontalHeaderDoubleClicked (int index)
void handleHorizontalSectionMoved (int index, int from, int to)
void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
void updateFormatBox ()
void updateTypeInfo ()
- Protected Slots inherited from MyWidget
void updateCaption ()
 Set caption according to current CaptionPolicy, name and label.

Private Attributes

QHash< const AbstractAspect
*, QString > 
d_stored_column_labels

Additional Inherited Members

- Protected Member Functions inherited from TableView
virtual void changeEvent (QEvent *event)
 Catches parent changes (in order to gain access to the title bar)
bool eventFilter (QObject *watched, QEvent *event)
 Filters other object's events (customizes title bar's context menu)
void retranslateStrings ()
void setColumnForControlTabs (int col)
- Protected Attributes inherited from TableView
QWidget * d_control_tabs
 Widget that contains the control tabs UI from ui.
TableItemDelegated_delegate
 Pointer to the item delegate.
QToolButton * d_hide_button
 Button to toogle the visibility of #d_tool_box.
TableDoubleHeaderViewd_horizontal_header
QHBoxLayout * d_main_layout
TableModeld_model
 Pointer to the current underlying model.
future::Tabled_table
TableViewWidgetd_view_widget
 The table view (first part of the UI)
Ui::ControlTabs ui
 UI with options tabs (description, format, formula etc.)
- Protected Attributes inherited from MyWidget
bool askOnClose
 Toggle on/off: Ask the user "delete, hide, or cancel?" on a close event.
QString birthdate
 The creation date.
CaptionPolicy caption_policy
 The caption policy.
FolderparentFolder
 Pointer to the parent folder of the window.
QWidget * titleBar
 Title bar of this MDI window if it currently belongs to a QWorkspace, NULL else.
QString w_label
 The window label.
Status w_status
 The window status.
- Protected Attributes inherited from scripted
ScriptingEnvscriptEnv

Detailed Description

MDI window providing a spreadsheet table with column logic.


Member Enumeration Documentation

Enumerator:
Numeric 
Text 
Date 
Time 
Month 
Day 
DateTime 

Constructor & Destructor Documentation

Table::Table ( ScriptingEnv env,
const QString &  fname,
const QString &  sep,
int  ignoredLines,
bool  renameCols,
bool  stripSpaces,
bool  simplifySpaces,
bool  convertToNumeric,
QLocale  numericFormat,
const QString &  label,
QWidget *  parent = 0,
const char *  name = 0,
Qt::WFlags  f = 0 
)
Table::Table ( ScriptingEnv env,
int  r,
int  c,
const QString &  label,
QWidget *  parent = 0,
const char *  name = 0,
Qt::WFlags  f = 0 
)

References d_future_table, init(), and Table().


Member Function Documentation

void Table::aboutToRemoveCol ( const QString &  )
signal
void Table::addCol ( SciDAVis::PlotDesignation  pd = SciDAVis::Y)
slot
void Table::addColumns ( int  c)
slot
void Table::addFunction ( )
protectedslot

References TableView::ui.

Referenced by init().

void Table::addReference ( )
protectedslot

References TableView::ui.

Referenced by init().

void Table::applyFormula ( )
protectedslot
double Table::cell ( int  row,
int  col 
)
slot

Return the value of the cell as a double.

If one of the indices or the cell content is invalid, return 0.0. For the next non-bugfix SciDAVis release, indication of failure should be done by returning NaN (wherever applicable). TODO: Make sure we don't rely on zero-on-failure, and document the resulting change in the Python API.

References column(), Column::columnMode(), Column::isInvalid(), Text, Column::textAt(), and Column::valueAt().

Referenced by Graph3D::addData(), Convolution::setDataFromTable(), Correlation::setDataFromTable(), FFT::setDataFromTable(), Fit::setYErrorSource(), Graph3D::updateDataXY(), Graph3D::updateDataXYZ(), and Graph3D::updateScales().

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
void Table::closeEvent ( QCloseEvent *  e)

Close event handler.

Ask the user "delete, hide, or cancel?" if the "ask on close" flag is set.

Reimplemented from MyWidget.

References MyWidget::askOnClose, d_future_table, MyWidget::hiddenWindow(), and AbstractAspect::remove().

QString Table::colComment ( int  col)
slot
QStringList Table::colComments ( )
slot
int Table::colIndex ( const QString &  name)
slot
QString Table::colLabel ( int  col)
slot
QString Table::colName ( int  col)
slot
QStringList Table::colNames ( )
slot
SciDAVis::PlotDesignation Table::colPlotDesignation ( int  col)
slot
Column* Table::column ( int  index) const
inlineslot

Return column number 'index'.

References future::Table::column(), and d_future_table.

Referenced by addCol(), Graph3D::addData(), Correlation::addResultCurve(), Convolution::addResultCurve(), applyFormula(), cell(), clearCell(), colComment(), colComments(), colIndex(), colLabel(), colName(), colNames(), colPlotDesignation(), columnFormat(), columnsList(), columnType(), columnTypes(), drawableColumnSelection(), DataPickerTool::end(), exportASCII(), firstXCol(), handleAspectDescriptionChange(), importASCII(), ApplicationWindow::importASCII(), ImportOPJ::importTables(), importV0x0001XXHeader(), init(), QwtHistogram::loadData(), QwtPieCurve::loadData(), DataCurve::loadData(), BoxCurve::loadData(), QwtErrorPlotCurve::loadData(), Fit::parametersTable(), plotDesignations(), Graph::plotHistogram(), Graph::plotPie(), recalculate(), DataPickerTool::removePoint(), TableStatistics::renameCol(), saveColumnTypes(), saveCommands(), saveComments(), saveHeader(), TranslateCurveTool::selectDestination(), selectedColumns(), selectedErrColumns(), selectedYColumns(), selectedYLabels(), setCell(), setColComment(), setColComments(), setColName(), setColPlotDesignation(), setColumnType(), setColumnTypes(), setCommand(), setCommands(), setHeader(), Graph::setLabelsTextFormat(), setText(), PlotDialog::showStatistics(), TableStatistics::TableStatistics(), text(), TableStatistics::update(), Graph::updateCurvesData(), Graph3D::updateDataXY(), Graph3D::updateDataXYZ(), Graph3D::updateScales(), and YColumns().

Column* Table::column ( const QString &  name) const
inlineslot

Return the column determined by the given name.

This method should not be used unless absolutely necessary. Columns should be addressed by their index. This method is mainly meant to be used in scripts.

References future::Table::column(), and d_future_table.

int Table::columnCount ( )
slot
QString Table::columnFormat ( int  col)
slot
QStringList Table::columnsList ( )
slot
int Table::columnType ( int  col)
slot
QList< int > Table::columnTypes ( )
slot
int Table::columnWidth ( int  col)
slot

References TableView::d_view_widget.

Referenced by print(), and saveColumnWidths().

int Table::colX ( int  col)
slot
int Table::colY ( int  col)
slot
bool Table::commentsEnabled ( )
slot
void Table::copy ( Table m)
slot
void Table::copySelection ( )
slot
void Table::customEvent ( QEvent *  e)
slot
void Table::cutSelection ( )
slot

Selection Operations.

References future::Table::cutSelection(), and d_future_table.

void Table::deleteSelectedRows ( )
slot
void Table::deselect ( )
slot
QStringList Table::drawableColumnSelection ( )
slot
bool Table::exportASCII ( const QString &  fname,
const QString &  separator,
bool  withLabels = false,
bool  exportSelection = false 
)
slot
void Table::exportPDF ( const QString &  fileName)
virtualslot

Reimplemented from MyWidget.

References print().

int Table::firstXCol ( )
slot
void Table::handleAspectDescriptionAboutToChange ( const AbstractAspect aspect)
protectedslot
void Table::handleAspectDescriptionChange ( const AbstractAspect aspect)
protectedslot
void Table::handleChange ( )
slot

References MyWidget::modifiedWindow().

Referenced by init().

void Table::handleColumnChange ( int  first,
int  count 
)
slot

References colName(), and modifiedData().

Referenced by handleColumnChange(), and init().

void Table::handleColumnChange ( int  top,
int  left,
int  bottom,
int  right 
)
slot

References handleColumnChange().

void Table::handleColumnsAboutToBeRemoved ( int  first,
int  count 
)
slot

References aboutToRemoveCol(), and colName().

Referenced by init().

void Table::handleColumnsRemoved ( int  first,
int  count 
)
slot

References colName(), and removedCol().

Referenced by init().

void Table::handleRowChange ( )
slot

References colName(), modifiedData(), and numCols().

Referenced by init().

void Table::importASCII ( const QString &  fname,
const QString &  sep,
int  ignoredLines,
bool  renameCols,
bool  stripSpaces,
bool  simplifySpaces,
bool  newTable 
)
slot
void Table::importV0x0001XXHeader ( QStringList  header)
slot
void Table::init ( )
slot
void Table::insertCol ( )
slot
void Table::insertCols ( int  start,
int  count 
)
slot
void Table::insertRow ( )
slot
void Table::modifiedData ( Table ,
const QString &   
)
signal
virtual QString Table::name ( )
inlinevirtual
bool Table::noXColumn ( )
slot
bool Table::noYColumn ( )
slot
int Table::numCols ( )
slot
int Table::numRows ( )
slot
int Table::numSelectedRows ( )
slot
void Table::pasteSelection ( )
slot
QList< int > Table::plotDesignations ( )
slot
void Table::print ( )
virtualslot

Reimplemented from MyWidget.

Referenced by exportPDF(), and recalculate().

void Table::print ( const QString &  fileName)
slot
bool Table::recalculate ( int  col,
bool  only_selected_rows = true 
)
slot
bool Table::recalculate ( )
slot

Recalculate selected cells.

References TableView::firstSelectedColumn(), and TableView::lastSelectedColumn().

Referenced by applyFormula(), and init().

void Table::removeCol ( )
slot
void Table::removeCol ( const QStringList &  list)
slot
void Table::removedCol ( const QString &  )
signal

Referenced by handleColumnsRemoved().

void Table::resizedTable ( QWidget *  )
signal
void Table::restore ( const QStringList &  )
virtualslot

Not implemented yet.

Reimplemented from MyWidget.

References importV0x0001XXHeader(), numCols(), setColComments(), setColumnTypes(), setColWidths(), and setCommands().

int Table::rowCount ( )
slot
QString Table::saveAsTemplate ( const QString &  geometryInfo)
virtualslot
QString Table::saveColumnTypes ( )
slot
QString Table::saveColumnWidths ( )
slot
QString Table::saveCommands ( )
slot
QString Table::saveComments ( )
slot
QString Table::saveHeader ( )
slot
void Table::saveToDevice ( QIODevice *  device,
const QString &  geometry 
)
slot
QString Table::saveToString ( const QString &  geometry)
virtualslot

Reimplemented from MyWidget.

Reimplemented in TableStatistics.

References d_future_table, and future::Table::save().

void Table::selectAllTable ( )
slot
int Table::selectedColsNumber ( )
slot
QStringList Table::selectedColumns ( )
slot
QStringList Table::selectedErrColumns ( )
slot
QStringList Table::selectedYColumns ( )
slot
QMap< int, QString > Table::selectedYLabels ( )
slot
void Table::setBackgroundColor ( const QColor &  col)
slot
virtual void Table::setBirthDate ( const QString &  s)
inlinevirtual
void Table::setCaptionPolicy ( CaptionPolicy  policy)
inlinevirtual
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)
slot
void Table::setColName ( int  col,
const QString &  text 
)
slot
void Table::setColPlotDesignation ( int  col,
SciDAVis::PlotDesignation  d 
)
slot
void Table::setColumnType ( int  col,
SciDAVis::ColumnMode  mode 
)
slot
void Table::setColumnTypes ( QList< int >  ctl)
slot
void Table::setColumnTypes ( const QStringList &  ctl)
slot
void Table::setColWidths ( const QStringList &  widths)
slot
void Table::setCommand ( int  col,
const QString &  com 
)
slot

Set formula for column col.

References column(), numRows(), and Column::setFormula().

Referenced by ApplicationWindow::openTable(), and ApplicationWindow::openTableStatistics().

void Table::setCommands ( const QStringList &  com)
slot
void Table::setCommands ( const QString &  com)
slot

Set all column formulae.

References setCommands().

void Table::setHeader ( QStringList  header)
slot
void Table::setHeaderColor ( const QColor &  col)
slot
void Table::setHeaderFont ( const QFont &  fnt)
slot
virtual void Table::setName ( const QString &  s)
inlinevirtual
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 ( SciDAVis::PlotDesignation  pd)
slot

References d_future_table, and future::Table::setSelectionAs().

Referenced by addCol().

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
virtual void Table::setWindowLabel ( const QString &  s)
inlinevirtual
void Table::showContextMenu ( bool  selection)
signal
QString Table::text ( int  row,
int  col 
)
slot
void Table::updateFunctionDoc ( )
protectedslot
int Table::verticalHeaderWidth ( )
slot
virtual QString Table::windowLabel ( )
inlinevirtual

Return the window label.

Reimplemented from MyWidget.

References AbstractAspect::comment(), and d_future_table.

Referenced by TableStatistics::saveToString().

QStringList Table::YColumns ( )
slot

Member Data Documentation

future::Table* Table::d_future_table
QHash<const AbstractAspect *, QString> Table::d_stored_column_labels
private

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