Relacs Core Library  0.9.8
Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
SpikeTrace Class Reference

#include <spiketrace.h>

Inheritance diagram for SpikeTrace:
Inheritance graph
[legend]
Collaboration diagram for SpikeTrace:
Collaboration graph
[legend]

Public Slots

void setSpike (bool on)
 
void setPause (bool pause)
 

Public Member Functions

 SpikeTrace (double spikewidth=1.0, int radius=6, int tracewidth=1, QWidget *parent=0)
 
 SpikeTrace (QWidget *parent=0)
 
 ~SpikeTrace (void)
 
QSize sizeHint (void) const
 
QSize minimumSizeHint (void) const
 
QSizePolicy sizePolicy (void) const
 

Protected Member Functions

void run (void)
 
void animate (void)
 
int trace (int x)
 
void resizeEvent (QResizeEvent *qre)
 
void paintEvent (QPaintEvent *qpe)
 
void customEvent (QEvent *qce)
 

Protected Attributes

bool Show
 
bool Pause
 
int Pos
 
int pPos
 
int dPos
 
int Radius
 
int TraceWidth
 
double SpikeSize
 
double SpikePos
 
double SpikeWidth
 
QMutex SMutex
 
SpikeTraceThreadThread
 

Friends

class SpikeTraceThread
 

Detailed Description

A nice, almost useless widget, showing an animated trace of a spike.

Author
Jan Benda
Version
1.0 The SpikeTrace-widget shows a darkgreen voltage trace with a single spike. A green ball is running from left to right along the trace. At each repetition the position of the spike is changed randomly. This is like the trace on an oscilloscope.

Use setSpike() to toggle this animation completly on and off. With setPause() the animation can be stopped and restarted.

Reimplementate trace() to get a better trace.

Constructor & Destructor Documentation

SpikeTrace ( double  spikewidth = 1.0,
int  radius = 6,
int  tracewidth = 1,
QWidget *  parent = 0 
)

Constructs the SpikeTrace-widget with the width of the spike set to spikewidth pixels, the radius of the ball set to radius pixels, and the width of the trace set to linewidth pixels.

References SpikeTrace::dPos, SpikeTrace::Pause, SpikeTrace::Pos, SpikeTrace::Radius, SpikeTrace::Show, SpikeTrace::SpikePos, SpikeTrace::SpikeSize, SpikeTrace::SpikeTraceThread, SpikeTrace::SpikeWidth, SpikeTrace::Thread, and SpikeTrace::TraceWidth.

SpikeTrace ( QWidget *  parent = 0)
~SpikeTrace ( void  )

Destructs the SpikeTrace-widget.

Member Function Documentation

QSize sizeHint ( void  ) const

Give a hint for the prefered size of this widget.

References SpikeTrace::Radius.

QSize minimumSizeHint ( void  ) const

Give a hint for the minimum size of this widget.

References SpikeTrace::Radius.

Referenced by SaveFiles::SaveFiles().

QSizePolicy sizePolicy ( void  ) const

Make this widget stretchable in both directions.

void setSpike ( bool  on)
slot
void setPause ( bool  pause)
slot

Stop and start animation.

References SpikeTrace::Pause, and SpikeTrace::SMutex.

Referenced by SaveFiles::openFiles(), and SaveFiles::writeToggle().

void run ( void  )
protected
void animate ( void  )
protected

Animates the spike trace by increasing the position of the ball and replace the spike on a new run.

References SpikeTrace::dPos, SpikeTrace::Pos, SpikeTrace::pPos, SpikeTrace::Radius, SpikeTrace::SpikePos, and SpikeTrace::SpikeWidth.

Referenced by SpikeTrace::paintEvent().

int trace ( int  x)
protected

A function providing the shape of the trace. For a given position x in pixels it returns the corresponding y-value (in pixels).

References relacs::exp(), SpikeTrace::SpikePos, SpikeTrace::SpikeSize, and SpikeTrace::SpikeWidth.

Referenced by SpikeTrace::paintEvent().

void resizeEvent ( QResizeEvent *  qre)
protected

Handles the resize event. It scales the position of the spike and its size appropriately.

References SpikeTrace::Radius, SpikeTrace::SMutex, SpikeTrace::SpikePos, and SpikeTrace::SpikeSize.

void paintEvent ( QPaintEvent *  qpe)
protected
void customEvent ( QEvent *  qce)
protected

Post update() to the GUI thread.

Friends And Related Function Documentation

friend class SpikeTraceThread
friend

Referenced by SpikeTrace::SpikeTrace().

Member Data Documentation

bool Show
protected

If true, the trace is painted.

Referenced by SpikeTrace::paintEvent(), SpikeTrace::run(), SpikeTrace::setSpike(), and SpikeTrace::SpikeTrace().

bool Pause
protected

If true, no animation is done.

Referenced by SpikeTrace::run(), SpikeTrace::setPause(), and SpikeTrace::SpikeTrace().

int Pos
protected
int pPos
protected

Previous position of the ball in pixel.

Referenced by SpikeTrace::animate(), SpikeTrace::setSpike(), and SpikeTrace::SpikeTrace().

int dPos
protected

Increment of the ball's position in pixel.

Referenced by SpikeTrace::animate(), and SpikeTrace::SpikeTrace().

int Radius
protected
int TraceWidth
protected

Width of the trace line.

Referenced by SpikeTrace::paintEvent(), and SpikeTrace::SpikeTrace().

double SpikeSize
protected

The current size of the spike in pixel.

Referenced by SpikeTrace::resizeEvent(), SpikeTrace::SpikeTrace(), and SpikeTrace::trace().

double SpikePos
protected
double SpikeWidth
protected

The width of the spike.

Referenced by SpikeTrace::animate(), SpikeTrace::SpikeTrace(), and SpikeTrace::trace().

QMutex SMutex
protected
SpikeTraceThread* Thread
protected

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