Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

QSMatrix Class Reference

Matrix class contains data used by QSData. More...

#include <qsmatrix.h>

Inheritance diagram for QSMatrix:

Inheritance graph
[legend]
List of all members.

Public Methods

 QSMatrix ()
virtual ~QSMatrix ()
virtual double value (int row, int col)=0
virtual QString string (int row, int col)
virtual int rows () const=0
virtual int cols () const=0
virtual bool resize (int rows, int cols)
virtual bool transpose ()
void copyRange (int row, int col, QSMatrix *src, int srcStartRow, int srcStartCol, int srcEndRow, int srcEndCol)
virtual void setDataObject (QSData *data, int channel)
QSDatadataObject () const
int channel () const
virtual void setValue (int row, int col, double value)
virtual void setString (int row, int col, const QString &string)
virtual bool isReference () const
virtual bool isEditable () const
virtual bool isString () const
virtual void dataChanging ()
virtual void dataChanged ()
virtual void loadStateFromStream (QDataStream &stream, QSObjectFactory *factory)
virtual void saveStateToStream (QDataStream &stream, QSObjectFactory *factory)

Protected Methods

 QSMatrix (const QSMatrix &)
void operator= (const QSMatrix &)

Protected Attributes

QSDatam_data_object
int m_channel

Detailed Description

Matrix class contains data used by QSData.

If you want your data to be used by this library you will have to make your implementation of this class. It is not as complicated as it looks. You will have to reimplement only : rows(), cols(), value() and optionally string(). There are other functions, which can be implemented: setValue(), setString(), resize(), transpose(), isReference(), isEditable(), isString(), loadStateFromStream(), saveStateToStream() Those memebers are not used by this library, but you will probably want to implement them in nontrivial projects for your own use..

When you call QSData::setMatrix(), setDataObject() is invoked. Later you can find out the parent object with dataObject() method. When you are going to change the data stored in the matrix you will have to call dataChanging() before and dataChanged() after the change. This notifies the parent QSData object about the change. It is important because it can be busy drawing the data at the moment and changing it during the operation can cause the crash.

see QSData::setMatrix()

Examples:

demo2d.cpp, and demo3d.cpp.


Constructor & Destructor Documentation

QSMatrix::QSMatrix  
 

Constructor

virtual QSMatrix::~QSMatrix   [virtual]
 

Destructor. Emits 'sigDeleting()'


Member Function Documentation

int QSMatrix::channel   const [inline]
 

Returns channel

virtual int QSMatrix::cols   const [pure virtual]
 

Return the number of columns in this matrix.

Examples:
demo2d.cpp, and demo3d.cpp.

void QSMatrix::copyRange int    row,
int    col,
QSMatrix *    src,
int    srcStartRow,
int    srcStartCol,
int    srcEndRow,
int    srcEndCol
 

Copy range.'dst' can be the same matrix.

virtual void QSMatrix::dataChanged   [virtual]
 

Calls QSData::dataChanged()

virtual void QSMatrix::dataChanging   [virtual]
 

Calls QSData::dataChanging()

QSData* QSMatrix::dataObject   const [inline]
 

Returns data object

virtual bool QSMatrix::isEditable   const [virtual]
 

If is editable using 'setValue()' this function should return true. Returns false by default.

virtual bool QSMatrix::isReference   const [virtual]
 

If true editor will be painted in blue.

virtual bool QSMatrix::isString   const [virtual]
 

Returns if this matrix holds elements as string raher than matrix.

virtual void QSMatrix::loadStateFromStream QDataStream &    stream,
QSObjectFactory   factory
[virtual]
 

Loads all properties

Reimplemented from QSSerializable.

virtual bool QSMatrix::resize int    rows,
int    cols
[virtual]
 

Resizes matrix ( preserves old data ). This should be reimplemented for each matrix type.Default implementation does nothing and returns 'false' ( 'operation not implemented' )

virtual int QSMatrix::rows   const [pure virtual]
 

Returns the number of rows in this matrix.

Examples:
demo2d.cpp, and demo3d.cpp.

virtual void QSMatrix::saveStateToStream QDataStream &    stream,
QSObjectFactory   factory
[virtual]
 

Saves all properties

Reimplemented from QSSerializable.

virtual void QSMatrix::setDataObject QSData   data,
int    channel
[virtual]
 

Sets a data object. It is called atomatically by QSData object, so there is no need to call it by hand.

virtual void QSMatrix::setString int    row,
int    col,
const QString &    string
[virtual]
 

Set string

virtual void QSMatrix::setValue int    row,
int    col,
double    value
[virtual]
 

This should be reimplemented to set a new value if editable() is TRUE. Doesn't call dataChanging() and dataChanged.

virtual QString QSMatrix::string int    row,
int    col
[inline, virtual]
 

Returns string at position ( row, col ). Default implementation calls value() and converts the result to string.

virtual bool QSMatrix::transpose   [inline, virtual]
 

Does transposition. This should be reimplemented. Default implementation does nothing and returns 'false' ( which means 'operation not implemented' ).

virtual double QSMatrix::value int    row,
int    col
[pure virtual]
 

Returns a value at position ( row, col ) in this matrix, converted to 'double'. This method must be redefined.

Examples:
demo2d.cpp, and demo3d.cpp.


The documentation for this class was generated from the following file:
Generated on Mon Mar 18 19:16:49 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002