QtPdWidgets  2.3.1
Public Types | Public Member Functions | Protected Member Functions | Properties | Private Attributes | List of all members
Pd::Bar Class Reference

Bar graph widget. More...

#include <Bar.h>

Inheritance diagram for Pd::Bar:
Inheritance graph
[legend]
Collaboration diagram for Pd::Bar:
Collaboration graph
[legend]

Public Types

enum  Orientation { Vertical, Horizontal }
 Orientation of the bar widget. More...
 
enum  Style { ColorBar, Arrow, MultiColorBar }
 Style of the bar widget. More...
 
enum  Origin { OriginZero, OriginMinimum, OriginMaximum }
 Bar origin mode. More...
 

Public Member Functions

 Bar (QWidget *parent=0)
 
virtual ~Bar ()
 Destructor. More...
 
Orientation getOrientation () const
 
void setOrientation (Orientation)
 Sets the orientation. More...
 
void resetOrientation ()
 Resets the orientation. More...
 
Style getStyle () const
 
void setStyle (Style)
 Sets the style. More...
 
void resetStyle ()
 Resets the style. More...
 
bool getShowScale () const
 
void setShowScale (bool)
 Sets, if the value scale shall be shown. More...
 
void resetShowScale ()
 Resets showScale. More...
 
double getScaleMin () const
 
void setScaleMin (double)
 Sets the value scale minimum. More...
 
void resetScaleMin ()
 Resets the value scale minimum. More...
 
double getScaleMax () const
 
void setScaleMax (double)
 Sets the value scale maximum. More...
 
void resetScaleMax ()
 Resets the value scale maximum. More...
 
Origin getOrigin () const
 
void setOrigin (Origin)
 Sets the bar origin. More...
 
void resetOrigin ()
 Resets the bar origin mode. More...
 
int getBorderWidth () const
 
void setBorderWidth (int)
 Sets the width of the border around the bar rect. More...
 
void resetBorderWidth ()
 Resets the borderWidth. More...
 
QColor getBackgroundColor () const
 
void setBackgroundColor (QColor)
 Sets the background color of the widget. More...
 
void resetBackgroundColor ()
 Resets the backgroundColor. More...
 
bool getAutoBarWidth () const
 
void setAutoBarWidth (bool)
 Sets the autoBarWidth flag of the widget. More...
 
void resetAutoBarWidth ()
 Resets the autoBarWidth. More...
 
QSize sizeHint () const override
 Gives a hint aboute the optimal size. More...
 
void addVariable (PdCom::Variable pv, const PdCom::Selector &selector={}, const QtPdCom::Transmission &=QtPdCom::event_mode, double scale=1.0, double offset=0.0, double tau=0.0, QColor color=Qt::blue)
 Connect to a process variable using a new bar stack. More...
 
void addVariable (PdCom::Process *process, const QString &path, const PdCom::Selector &selector={}, const QtPdCom::Transmission &=QtPdCom::event_mode, double scale=1.0, double offset=0.0, double tau=0.0, QColor color=Qt::blue)
 
void addStackedVariable (PdCom::Variable pv, const PdCom::Selector &selector={}, const QtPdCom::Transmission &=QtPdCom::event_mode, double scale=1.0, double offset=0.0, double tau=0.0, QColor color=Qt::blue)
 Connect to a process variable using the last stack. More...
 
void addStackedVariable (PdCom::Process *process, const QString &path, const PdCom::Selector &selector={}, const QtPdCom::Transmission &=QtPdCom::event_mode, double scale=1.0, double offset=0.0, double tau=0.0, QColor color=Qt::blue)
 
void clearVariables ()
 Clear all stacks and sections. More...
 
void setVariable (PdCom::Variable pv, const PdCom::Selector &selector={}, const QtPdCom::Transmission &=QtPdCom::event_mode, double scale=1.0, double offset=0.0, double tau=0.0, QColor color=Qt::blue)
 Clear all stacks and sections and add a single variable. More...
 
void setVariable (PdCom::Process *process, const QString &path, const PdCom::Selector &selector={}, const QtPdCom::Transmission &=QtPdCom::event_mode, double scale=1.0, double offset=0.0, double tau=0.0, QColor color=Qt::blue)
 
void clearData ()
 
void setGradientStops (const QGradientStops &)
 
const QPair< double, double > getGradientLimits () const
 

Protected Member Functions

bool event (QEvent *) override
 Event handler. More...
 
void resizeEvent (QResizeEvent *) override
 Processes a resize event. More...
 
void paintEvent (QPaintEvent *event) override
 Paint function. More...
 

Properties

Orientation orientation
 
Style style
 
bool showScale
 
double scaleMin
 
double scaleMax
 
Origin origin
 
int borderWidth
 
QColor backgroundColor
 
bool autoBarWidth
 

Private Attributes

QScopedPointer< BarPrivate > const d_ptr
 

Detailed Description

Bar graph widget.

Member Enumeration Documentation

◆ Orientation

Orientation of the bar widget.

Enumerator
Vertical 

Vertical bar with scale on the left.

Horizontal 

Horizontal bar with scale on top.

◆ Origin

Bar origin mode.

This determines, from where bars are drawn.

Enumerator
OriginZero 

Draw bars originating from zero.

OriginMinimum 

Draw bars originating from the scale minimum.

If orientation is set to Vertical, this is the bottom of the bar area, while with orientation set to Horizontal, this is the left side of the bar area.

OriginMaximum 

Draw bars originating from the scale maximum.

If orientation is set to Vertical, this is the top of the bar area, while with orientation set to Horizontal, this is the right side of the bar area.

◆ Style

Style of the bar widget.

Enumerator
ColorBar 

Display colored bars over a plain background.

Arrow 

Display arrows over a colored background.

MultiColorBar 

Display solid colored bar acc.

to value.

Constructor & Destructor Documentation

◆ Bar()

Bar::Bar ( QWidget *  parent = 0)

◆ ~Bar()

Bar::~Bar ( )
virtual

Destructor.

References clearVariables().

Member Function Documentation

◆ addStackedVariable() [1/2]

void Bar::addStackedVariable ( PdCom::Variable  pv,
const PdCom::Selector &  selector = {},
const QtPdCom::Transmission &  transmission = QtPdCom::event_mode,
double  scale = 1.0,
double  offset = 0.0,
double  tau = 0.0,
QColor  color = Qt::blue 
)

Connect to a process variable using the last stack.

The variable is placed as upper element of the last stack. If no stacks exist, the forst one is created.

See also
addVariable().
ScalarSubscriber::setVariable().
Parameters
pvProcess variable.
selectorSelector.
transmissionTransmission.
scaleScale factor.
offsetOffset (applied after scaling.
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.
colorBar color.

References addVariable().

Referenced by addVariable().

◆ addStackedVariable() [2/2]

void Bar::addStackedVariable ( PdCom::Process *  process,
const QString &  path,
const PdCom::Selector &  selector = {},
const QtPdCom::Transmission &  transmission = QtPdCom::event_mode,
double  scale = 1.0,
double  offset = 0.0,
double  tau = 0.0,
QColor  color = Qt::blue 
)
Parameters
processProcess.
pathVariable path.
selectorSelector.
transmissionTransmission.
scaleScale factor.
offsetOffset (applied after scaling.
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.
colorBar color.

References addVariable().

◆ addVariable() [1/2]

void Bar::addVariable ( PdCom::Variable  pv,
const PdCom::Selector &  selector = {},
const QtPdCom::Transmission &  transmission = QtPdCom::event_mode,
double  scale = 1.0,
double  offset = 0.0,
double  tau = 0.0,
QColor  color = Qt::blue 
)

Connect to a process variable using a new bar stack.

A new stack (horizontal division for veritcal bar orientation) is created. A stack can display multiple sections on top of each other (speaking for vertical bar orientation). To add a new section to an existing stack, use addStackedVariable().

See also
ScalarSubscriber::setVariable().
Parameters
pvProcess variable.
selectorSelector.
transmissionTransmission.
scaleScale factor.
offsetOffset (applied after scaling).
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.
colorBar color.

References addStackedVariable().

Referenced by addStackedVariable(), and setVariable().

◆ addVariable() [2/2]

void Bar::addVariable ( PdCom::Process *  process,
const QString &  path,
const PdCom::Selector &  selector = {},
const QtPdCom::Transmission &  transmission = QtPdCom::event_mode,
double  scale = 1.0,
double  offset = 0.0,
double  tau = 0.0,
QColor  color = Qt::blue 
)
Parameters
processProcess.
pathVariable path.
selectorSelector.
transmissionTransmission.
scaleScale factor.
offsetOffset (applied after scaling).
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.
colorBar color.

References addStackedVariable().

◆ clearData()

void Bar::clearData ( )

◆ clearVariables()

void Bar::clearVariables ( )

Clear all stacks and sections.

Referenced by setVariable(), and ~Bar().

◆ event()

bool Bar::event ( QEvent *  event)
overrideprotected

Event handler.

Parameters
eventPaint event flags.

Referenced by paintEvent().

◆ getAutoBarWidth()

bool Bar::getAutoBarWidth ( ) const
Returns
The autoBarWidth of the widget.

◆ getBackgroundColor()

QColor Bar::getBackgroundColor ( ) const
Returns
The backgroundColor of the widget.

◆ getBorderWidth()

int Bar::getBorderWidth ( ) const
Returns
The borderWidth around the bar rect.

◆ getGradientLimits()

const QPair< double, double > Bar::getGradientLimits ( ) const

◆ getOrientation()

Bar::Orientation Bar::getOrientation ( ) const
Returns
The orientation.

◆ getOrigin()

Bar::Origin Bar::getOrigin ( ) const
Returns
The bar drawing origin.

◆ getScaleMax()

double Bar::getScaleMax ( ) const
Returns
The value scale's maximum value.

◆ getScaleMin()

double Bar::getScaleMin ( ) const
Returns
The value scale's minimum value.

◆ getShowScale()

bool Bar::getShowScale ( ) const
Returns
true, if the scale is shown.

References showScale.

◆ getStyle()

Bar::Style Bar::getStyle ( ) const

◆ paintEvent()

void Bar::paintEvent ( QPaintEvent *  event)
overrideprotected

Paint function.

Parameters
eventpaint event flags

References event().

◆ resetAutoBarWidth()

void Bar::resetAutoBarWidth ( )

Resets the autoBarWidth.

References DEFAULT_AUTOBARWIDTH, and setAutoBarWidth().

◆ resetBackgroundColor()

void Bar::resetBackgroundColor ( )

◆ resetBorderWidth()

void Bar::resetBorderWidth ( )

Resets the borderWidth.

References DEFAULT_BORDERWIDTH, and setBorderWidth().

◆ resetOrientation()

void Bar::resetOrientation ( )

Resets the orientation.

References DEFAULT_ORIENTATION, and setOrientation().

◆ resetOrigin()

void Bar::resetOrigin ( )

Resets the bar origin mode.

References DEFAULT_ORIGIN, and setOrigin().

◆ resetScaleMax()

void Bar::resetScaleMax ( )

Resets the value scale maximum.

References DEFAULT_SCALEMAX, and setScaleMax().

◆ resetScaleMin()

void Bar::resetScaleMin ( )

Resets the value scale minimum.

References DEFAULT_SCALEMIN, and setScaleMin().

◆ resetShowScale()

void Bar::resetShowScale ( )

Resets showScale.

References DEFAULT_SHOWSCALE, and setShowScale().

◆ resetStyle()

void Bar::resetStyle ( )

Resets the style.

References DEFAULT_STYLE, and setStyle().

◆ resizeEvent()

void Bar::resizeEvent ( QResizeEvent *  )
overrideprotected

Processes a resize event.

◆ setAutoBarWidth()

void Bar::setAutoBarWidth ( bool  a)

Sets the autoBarWidth flag of the widget.

Referenced by resetAutoBarWidth().

◆ setBackgroundColor()

void Bar::setBackgroundColor ( QColor  c)

Sets the background color of the widget.

Referenced by resetBackgroundColor().

◆ setBorderWidth()

void Bar::setBorderWidth ( int  width)

Sets the width of the border around the bar rect.

Referenced by resetBorderWidth().

◆ setGradientStops()

void Bar::setGradientStops ( const QGradientStops &  g)

◆ setOrientation()

void Bar::setOrientation ( Orientation  orientation)

◆ setOrigin()

void Bar::setOrigin ( Origin  o)

Sets the bar origin.

See also
Origin.

Referenced by resetOrigin().

◆ setScaleMax()

void Bar::setScaleMax ( double  val)

Sets the value scale maximum.

Referenced by resetScaleMax().

◆ setScaleMin()

void Bar::setScaleMin ( double  val)

Sets the value scale minimum.

Referenced by resetScaleMin().

◆ setShowScale()

void Bar::setShowScale ( bool  showScale)

Sets, if the value scale shall be shown.

References showScale.

Referenced by resetShowScale().

◆ setStyle()

void Bar::setStyle ( Style  s)

Sets the style.

Referenced by resetStyle().

◆ setVariable() [1/2]

void Bar::setVariable ( PdCom::Variable  pv,
const PdCom::Selector &  selector = {},
const QtPdCom::Transmission &  transmission = QtPdCom::event_mode,
double  scale = 1.0,
double  offset = 0.0,
double  tau = 0.0,
QColor  color = Qt::blue 
)

Clear all stacks and sections and add a single variable.

Deprecated:
See also
addVariable()
Parameters
pvProcess variable.
selectorSelector.
transmissionTransmission.
scaleScale factor.
offsetOffset (applied after scaling).
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.
colorBar color.

References addVariable(), and clearVariables().

◆ setVariable() [2/2]

void Bar::setVariable ( PdCom::Process *  process,
const QString &  path,
const PdCom::Selector &  selector = {},
const QtPdCom::Transmission &  transmission = QtPdCom::event_mode,
double  scale = 1.0,
double  offset = 0.0,
double  tau = 0.0,
QColor  color = Qt::blue 
)
Parameters
processProcess.
pathVariable path.
selectorSelector.
transmissionTransmission.
scaleScale factor.
offsetOffset (applied after scaling).
tauPT1 filter time constant. A value less or equal to 0.0 means, that no filter is applied.
colorBar color.

References addVariable(), and clearVariables().

◆ sizeHint()

QSize Bar::sizeHint ( ) const
override

Gives a hint aboute the optimal size.

References Vertical.

Member Data Documentation

◆ d_ptr

QScopedPointer<BarPrivate> const Pd::Bar::d_ptr
private

Property Documentation

◆ autoBarWidth

bool Pd::Bar::autoBarWidth
readwrite

◆ backgroundColor

QColor Pd::Bar::backgroundColor
readwrite

◆ borderWidth

int Pd::Bar::borderWidth
readwrite

◆ orientation

Orientation Pd::Bar::orientation
readwrite

Referenced by setOrientation().

◆ origin

Origin Pd::Bar::origin
readwrite

◆ scaleMax

double Pd::Bar::scaleMax
readwrite
See also
setScaleMax()

◆ scaleMin

double Pd::Bar::scaleMin
readwrite
See also
setScaleMin()

◆ showScale

bool Pd::Bar::showScale
readwrite

◆ style

Style Pd::Bar::style
readwrite

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