VariablePill Class Reference

A variable pill. More...

#include <VariablePill.hh>

Inherits QWidget.

Signals

void VariableAdded (const unsigned int _id, const std::string &_name)
 Qt signal emitted when a child variable pill is added. More...
 
void VariableLabelChanged (const std::string &_label)
 Qt signal emitted when the variable pill's text has changed. More...
 
void VariableMoved (const unsigned int _id)
 Qt signal emitted when an existing variable pill is added as a child of this variable pill. More...
 
void VariableRemoved (const unsigned int _id)
 Qt signal emitted when a child variable pill is removed. More...
 

Public Member Functions

 VariablePill (QWidget *_parent=nullptr)
 Constructor. More...
 
virtual ~VariablePill ()
 Destructor. More...
 
void AddVariablePill (VariablePill *_variable)
 Add a child variable pill. More...
 
VariablePillContainerContainer () const
 Get the container which holds this variable pill. More...
 
bool ContainsPoint (const ignition::math::Vector2i &_pt) const
 Check if a point is inside the widget. More...
 
unsigned int Id () const
 Get the unique id of this variable pill. More...
 
bool IsSelected () const
 Return the selected state of this variable pill. More...
 
std::string Name () const
 Get the unique name for this variable. More...
 
VariablePillParent () const
 Get the parent of this variable pill. More...
 
void RemoveVariablePill (VariablePill *_variable)
 Remove a child variable pill. More...
 
void SetContainer (VariablePillContainer *_container)
 Set the container which holds this variable pill. More...
 
void SetName (const std::string &_name)
 Set a unique name for this variable. More...
 
void SetParent (VariablePill *_parent)
 Set the parent of this variable pill. More...
 
void SetSelected (const bool _selected)
 Set the selected state of this variable pill. More...
 
void SetText (const std::string &_text)
 Set the text label for this variable pill. More...
 
std::string Text () const
 Get the text label for this variable pill. More...
 
VariablePillVariablePillByName (const std::string &_name)
 Get a child variable pill by its unique name. More...
 
unsigned int VariablePillCount () const
 Get the number of child variable pills. More...
 
std::map< unsigned int,
VariablePill * > & 
VariablePills () const
 Get the a child variable pill. More...
 

Static Public Attributes

static const unsigned int EmptyVariable
 Empty variable id used to indicate non-existent variable. More...
 

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *_evt)
 Used to accept drag enter events. More...
 
void dropEvent (QDropEvent *_evt)
 Used to accept drop events. More...
 
void mouseMoveEvent (QMouseEvent *_event)
 Qt mouse press event. More...
 
void mousePressEvent (QMouseEvent *_event)
 Qt mouse move event. More...
 

Detailed Description

A variable pill.

Constructor & Destructor Documentation

VariablePill ( QWidget *  _parent = nullptr)

Constructor.

Parameters
[in]_parentPointer to a parent widget
virtual ~VariablePill ( )
virtual

Destructor.

Member Function Documentation

void AddVariablePill ( VariablePill _variable)

Add a child variable pill.

This becomes a multi-variable pill.

Parameters
[in]_variableChild variable pill to add.
VariablePillContainer* Container ( ) const

Get the container which holds this variable pill.

Returns
_container Container that holds this variable pill.
bool ContainsPoint ( const ignition::math::Vector2i &  _pt) const

Check if a point is inside the widget.

Parameters
[in]_ptPoint to check.
Returns
True if the point is inside the widget.
void dragEnterEvent ( QDragEnterEvent *  _evt)
protected

Used to accept drag enter events.

Parameters
[in]_evtThe drag event.
void dropEvent ( QDropEvent *  _evt)
protected

Used to accept drop events.

Parameters
[in]_evtThe drop event.
unsigned int Id ( ) const

Get the unique id of this variable pill.

Returns
Unique id;
bool IsSelected ( ) const

Return the selected state of this variable pill.

Returns
Selected state.
void mouseMoveEvent ( QMouseEvent *  _event)
protected

Qt mouse press event.

Parameters
[in]_eventQt mouse event.
void mousePressEvent ( QMouseEvent *  _event)
protected

Qt mouse move event.

Parameters
[in]_eventQt mouse event.
std::string Name ( ) const

Get the unique name for this variable.

Returns
Name for this variable
VariablePill* Parent ( ) const

Get the parent of this variable pill.

Returns
Parent variable pill.
void RemoveVariablePill ( VariablePill _variable)

Remove a child variable pill.

Parameters
[in]_variableChild variable pill to remove.
void SetContainer ( VariablePillContainer _container)

Set the container which holds this variable pill.

Parameters
[in]_containerContainer to hold this variable pill.
void SetName ( const std::string &  _name)

Set a unique name for this variable.

Parameters
[in]_nameName of the variable.
void SetParent ( VariablePill _parent)

Set the parent of this variable pill.

Parameters
[in]_parentParent variable pill.
void SetSelected ( const bool  _selected)

Set the selected state of this variable pill.

Parameters
[in]_selectedTrue to set the state to be selected.
void SetText ( const std::string &  _text)

Set the text label for this variable pill.

Parameters
[in]_textText to set the label to.
std::string Text ( ) const

Get the text label for this variable pill.

Returns
the text label.
void VariableAdded ( const unsigned int  _id,
const std::string &  _name 
)
signal

Qt signal emitted when a child variable pill is added.

Parameters
[in]_idUnique id of the child variable pill.
[in]_nameName of variable pill added.
void VariableLabelChanged ( const std::string &  _label)
signal

Qt signal emitted when the variable pill's text has changed.

Parameters
[in]_labelNew variable label.
void VariableMoved ( const unsigned int  _id)
signal

Qt signal emitted when an existing variable pill is added as a child of this variable pill.

Parameters
[in]_idUnique id of the existing variable pill that is added.
VariablePill* VariablePillByName ( const std::string &  _name)

Get a child variable pill by its unique name.

Parameters
[in]_nameName of the variable pill
Returns
Child variable pill.
unsigned int VariablePillCount ( ) const

Get the number of child variable pills.

Returns
Number of child variable pills.
std::map<unsigned int, VariablePill *>& VariablePills ( ) const

Get the a child variable pill.

Parameters
[in]_indexIndex of the child variable pill.
void VariableRemoved ( const unsigned int  _id)
signal

Qt signal emitted when a child variable pill is removed.

Parameters
[in]_idName of child variable pill removed.

Member Data Documentation

const unsigned int EmptyVariable
static

Empty variable id used to indicate non-existent variable.


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