Relacs Plot Library  0.9.8
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
MultiPlot Class Reference

#include <multiplot.h>

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

Public Slots

void popRanges (void)
 
void resetRanges (void)
 

Signals

void changedRanges (int id)
 
void resizePlots (QResizeEvent *qre)
 

Public Member Functions

 MultiPlot (int plots, int columns, bool horizontal, Plot::KeepMode keep=Plot::Copy, QWidget *parent=0)
 
 MultiPlot (int plots, int columns, bool horizontal=true, QWidget *parent=0)
 
 MultiPlot (int plots, Plot::KeepMode keep, QWidget *parent=0)
 
 MultiPlot (int plots, QWidget *parent=0)
 
 MultiPlot (QWidget *parent=0)
 
 ~MultiPlot (void)
 
void lock (void)
 
bool tryLock (int timeoutms=1)
 
void unlock (void)
 
void setDataMutex (QMutex *mutex)
 
void setDataMutex (QReadWriteLock *mutex)
 
void clearDataMutex (void)
 
int size (void) const
 
bool empty (void) const
 
void resize (int plots, Plot::KeepMode keep=Plot::Copy)
 
void resize (int plots, int columns, bool horizontal, Plot::KeepMode keep=Plot::Copy)
 
void clear (void)
 
void erase (int index)
 
Plotoperator[] (int i)
 
Plotback (void)
 
Plotfront (void)
 
void layout (int columns, bool horizontal=true)
 
void layout (void)
 
void setCommonXRange (int plot1, int plot2)
 
void setCommonXRange (void)
 
void setCommonYRange (int plot1, int plot2)
 
void setCommonYRange (void)
 
void setCommonRange (int plot1, int plot2)
 
void setCommonRange (void)
 
virtual QSize sizeHint (void) const
 
virtual QSize minimumSizeHint (void) const
 
void draw (void)
 
void setDrawBackground (void)
 
void clearPlots (void)
 
void enableMouse (void)
 
void disableMouse (void)
 

Protected Slots

void setRanges (int id)
 

Protected Member Functions

void paintEvent (QPaintEvent *qpe)
 
void resizeEvent (QResizeEvent *qre)
 
void customEvent (QEvent *qce)
 
void doResize (int plots, Plot::KeepMode keep)
 
void doClear (void)
 
void doErase (int index)
 
virtual void mousePressEvent (QMouseEvent *qme)
 
virtual void mouseReleaseEvent (QMouseEvent *qme)
 
virtual void mouseDoubleClickEvent (QMouseEvent *qme)
 
virtual void mouseMoveEvent (QMouseEvent *qme)
 

Detailed Description

Having several Plots in a single widget.

Author
Jan Benda

Constructor & Destructor Documentation

MultiPlot ( int  plots,
int  columns,
bool  horizontal,
Plot::KeepMode  keep = Plot::Copy,
QWidget *  parent = 0 
)

Constructs plots plots with KeepMode keep. If you set keep to Plot::Pointer and you are using multible threads, then you need to provide a mutex for locking the data via setDataMutex().

MultiPlot ( int  plots,
int  columns,
bool  horizontal = true,
QWidget *  parent = 0 
)

Constructs plots plots.

References Plot::Copy.

MultiPlot ( int  plots,
Plot::KeepMode  keep,
QWidget *  parent = 0 
)

Constructs plots plots with KeepMode keep. If you set keep to Plot::Pointer and you are using multible threads, then you need to provide a mutex for locking the data via setDataMutex().

MultiPlot ( int  plots,
QWidget *  parent = 0 
)

References Plot::Copy.

MultiPlot ( QWidget *  parent = 0)

References Plot::Copy.

~MultiPlot ( void  )

References MultiPlot::clear().

Member Function Documentation

void lock ( void  )
bool tryLock ( int  timeoutms = 1)

Try to lock the plot mutex for at maximum timeoutms milliseconds.

void unlock ( void  )
void setDataMutex ( QMutex *  mutex)

Provide a mutex for all subplots that is used to lock access to all data while they are plotted. If you want to change the mutex, you first have to disable the mutex by calling clearDataMutex().

See Also
setDataMutex(QReadWriteLock*)

Referenced by MultiPlot::setDataMutex().

void setDataMutex ( QReadWriteLock *  mutex)

Provide a mutex for all subplots that is used to lock reading access to all data while they are plotted. If you want to change the mutex, you first have to disable the mutex by calling clearDataMutex().

See Also
setDataMutex(QMutex*)

References MultiPlot::setDataMutex().

void clearDataMutex ( void  )

Disables the data mutex and the data mutexes of the subplots.

See Also
setDataMutex()
int size ( void  ) const

The number of Plots in the MultiPlot widget.

Referenced by MultiPlot::doResize().

bool empty ( void  ) const

True if there isn't any Plot in the MultiPlot widget.

void resize ( int  plots,
Plot::KeepMode  keep = Plot::Copy 
)

Change the number of plots to plots. The zoom-stacks of all plots are reset (Plot::resetRanges() ) and the common X and Y ranges are cleared.

Note
the plot mutex must be locked ( lock() ), when calling this function!

References MultiPlot::doResize().

Referenced by MultiPlot::resize().

void resize ( int  plots,
int  columns,
bool  horizontal,
Plot::KeepMode  keep = Plot::Copy 
)

Change the number of plots to plots and update the layout. The zoom-stacks of all plots are reset (Plot::resetRanges() ) and the common X and Y ranges are cleared.

Note
the plot mutex must be locked ( lock() ), when calling this function!

References MultiPlot::layout(), and MultiPlot::resize().

void clear ( void  )

Remove all Plots from the MultiPlot widget.

Note
the plot mutex must be locked ( lock() ), when calling this function!

References MultiPlot::doClear().

Referenced by MultiPlot::~MultiPlot().

void erase ( int  index)

Remove Plot number index from the MultiPlot widget.

Note
the plot mutex must be locked ( lock() ), when calling this function!

References MultiPlot::doErase().

Plot& operator[] ( int  i)
inline

The Plot-widget i.

Plot& back ( void  )
inline

The last Plot in the list.

Plot& front ( void  )
inline

The first Plot in the list.

void layout ( int  columns,
bool  horizontal = true 
)

References MultiPlot::layout().

void layout ( void  )
void setCommonXRange ( int  plot1,
int  plot2 
)
void setCommonXRange ( void  )
void setCommonYRange ( int  plot1,
int  plot2 
)
void setCommonYRange ( void  )
void setCommonRange ( int  plot1,
int  plot2 
)
void setCommonRange ( void  )
QSize sizeHint ( void  ) const
virtual

Give a hint for the prefered size of this widget.

References relacs::ceil().

QSize minimumSizeHint ( void  ) const
virtual

Give a hint for the minimum size of this widget.

References relacs::ceil().

void draw ( void  )

Draw the Plots.

Referenced by Plot::draw().

void setDrawBackground ( void  )

To be called from a Plot to request to redraw the background.

Referenced by Plot::setOrigin(), and Plot::setSize().

void clearPlots ( void  )

Clear each Plot from data, i.e. call Plot::clear() for each Plot.

void enableMouse ( void  )

Enable mouse support for all subplots.

void disableMouse ( void  )

Disable mouse support for all subplots.

void changedRanges ( int  id)
signal

Ranges of some plots have been changed due to a change in plot id. The plot range was changed by the user. Both the MultiPlot mutex and the mutex of the Plot that initiated the changed ranges are locked.

Referenced by MultiPlot::setRanges().

void resizePlots ( QResizeEvent *  qre)
signal

This signal is emitted whenever the MultiPlot widget receives a resizeEvent() before processing it. Can be used to change e.g. the origin and size of the plots.

Referenced by MultiPlot::resizeEvent().

void popRanges ( void  )
slot

Set the ranges of all stacks according to the last zoom-stack entry and remove it from the stack.

void resetRanges ( void  )
slot

Clears the zoom stack of all plots.

void paintEvent ( QPaintEvent *  qpe)
protected

Paints the entire plot.

References Plot::draw(), Plot::scale(), Plot::tryLockData(), and Plot::unlockData().

void resizeEvent ( QResizeEvent *  qre)
protected
void customEvent ( QEvent *  qce)
protected
void doResize ( int  plots,
Plot::KeepMode  keep 
)
protected
void doClear ( void  )
protected
void doErase ( int  index)
protected
void mousePressEvent ( QMouseEvent *  qme)
protectedvirtual

The Qt mouse event handler for a mouse press event. Dispatches the event to the appropriate Plot.

void mouseReleaseEvent ( QMouseEvent *  qme)
protectedvirtual

The Qt mouse event handler for a mouse release event. Dispatches the event to the appropriate Plot.

void mouseDoubleClickEvent ( QMouseEvent *  qme)
protectedvirtual

The Qt mouse event handler for a mouse doouble click event. Dispatches the event to the appropriate Plot.

void mouseMoveEvent ( QMouseEvent *  qme)
protectedvirtual

The Qt mouse event handler for a mouse move event. Dispatches the event to the appropriate Plot.

void setRanges ( int  id)
protectedslot

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