VariablePillContainer Class Reference

A container for holding variable pills. More...

#include <VariablePillContainer.hh>

Inherits QWidget.

Signals

void VariableAdded (const unsigned int _id, const std::string &_name, const unsigned int _targetId)
 Qt signal emitted when a variable is added to the container. More...
 
void VariableLabelChanged (const unsigned int _id, const std::string &_label)
 Qt signal emitted when a variable label has changed. More...
 
void VariableMoved (const unsigned int _id, const unsigned int _targetId)
 Qt signal emitted when a variable is moved into the container. More...
 
void VariableRemoved (const unsigned int _id, const unsigned int _targetId)
 Qt signal emitted when a variable is removed from the container. More...
 

Public Member Functions

 VariablePillContainer (QWidget *_parent=nullptr)
 Constructor. More...
 
virtual ~VariablePillContainer ()
 Destructor. More...
 
unsigned int AddVariablePill (const std::string &_name, const unsigned int _targetId=VariablePill::EmptyVariable)
 Add a new variable pill to a multi-variable pill in the container. More...
 
void AddVariablePill (VariablePill *_variable, const unsigned int _targetId=VariablePill::EmptyVariable)
 Add a variable pill to the container. More...
 
VariablePillGetVariablePill (const unsigned int _id) const
 Get a variable pill by id. More...
 
int MaxSize () const
 Get the maximum number of variable pills this container can hold. More...
 
void RemoveVariablePill (VariablePill *_variable)
 Remove a variable pill from the container. More...
 
void RemoveVariablePill (const unsigned int _id)
 Remove a variable pill from the container. More...
 
void SetMaxSize (const int _max)
 Set the maximum number of variable pills this container can hold. More...
 
void SetSelected (VariablePill *_variable)
 Set the selected state of a variable pill. More...
 
void SetText (const std::string &_text)
 Set the label text for this variable pill container. More...
 
void SetVariablePillLabel (const unsigned int _id, const std::string &_text)
 Set the label text for a variable pill in this container. More...
 
std::string Text () const
 Get the variable pill container's label text. More...
 
unsigned int VariablePillCount () const
 Get the number of child variable pills. 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...
 
virtual void keyPressEvent (QKeyEvent *_event)
 Qt callback when a key is pressed. More...
 
void mouseReleaseEvent (QMouseEvent *_event)
 Qt callback when the mouse is released. More...
 

Detailed Description

A container for holding variable pills.

Constructor & Destructor Documentation

VariablePillContainer ( QWidget *  _parent = nullptr)
explicit

Constructor.

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

Destructor.

Member Function Documentation

unsigned int AddVariablePill ( const std::string &  _name,
const unsigned int  _targetId = VariablePill::EmptyVariable 
)

Add a new variable pill to a multi-variable pill in the container.

Parameters
[in]_nameName of variable pill to add.
[in]_targetIdUnqiue id of the variable pill to add to.
void AddVariablePill ( VariablePill _variable,
const unsigned int  _targetId = VariablePill::EmptyVariable 
)

Add a variable pill to the container.

Parameters
[in]_variableVariable pill to add.
[in]_targetIdUnqiue id of the variable pill to add to.
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.
VariablePill* GetVariablePill ( const unsigned int  _id) const

Get a variable pill by id.

Parameters
[in]_idVariable pill id
Returns
Variable pill with the specified id.
virtual void keyPressEvent ( QKeyEvent *  _event)
protectedvirtual

Qt callback when a key is pressed.

Parameters
[in]_eventQt key event.
int MaxSize ( ) const

Get the maximum number of variable pills this container can hold.

Returns
Maximum number of variable pills. -1 means unlimited.
void mouseReleaseEvent ( QMouseEvent *  _event)
protected

Qt callback when the mouse is released.

Parameters
[in]_eventQt mouse event.
void RemoveVariablePill ( VariablePill _variable)

Remove a variable pill from the container.

Parameters
[in]_variableVariable pill to remove.
void RemoveVariablePill ( const unsigned int  _id)

Remove a variable pill from the container.

Parameters
[in]_idUnique id of the variable pill to remove.
void SetMaxSize ( const int  _max)

Set the maximum number of variable pills this container can hold.

Parameters
[in]_maxMaximum number of variable pills. -1 means unlimited.
void SetSelected ( VariablePill _variable)

Set the selected state of a variable pill.

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

Set the label text for this variable pill container.

Parameters
[in]_textText to set the label to.
void SetVariablePillLabel ( const unsigned int  _id,
const std::string &  _text 
)

Set the label text for a variable pill in this container.

Parameters
[in]_idUnique id of the variable pill.
[in]_textText to set the variable pill label to.
std::string Text ( ) const

Get the variable pill container's label text.

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

Qt signal emitted when a variable is added to the container.

Parameters
[in]_idUnique id of the variable pill.
[in]_nameName of variable pill added.
[in]_targetIdUnique id of the target variable pill that this variable is added to. VariablePill::EmptyVariable if it is added to a container and not a variable pill.
void VariableLabelChanged ( const unsigned int  _id,
const std::string &  _label 
)
signal

Qt signal emitted when a variable label has changed.

Parameters
[in]_idUnique id of the variable pill.
[in]_labelNew variable label.
void VariableMoved ( const unsigned int  _id,
const unsigned int  _targetId 
)
signal

Qt signal emitted when a variable is moved into the container.

Parameters
[in]_idUnique id of the variable pill.
[in]_targetIdUnique id of the target variable pill that this variable has moved to. VariablePill::EmptyVariable if it moved to a container and not a variable pill.
unsigned int VariablePillCount ( ) const

Get the number of child variable pills.

Returns
Number of child variable pills.
void VariableRemoved ( const unsigned int  _id,
const unsigned int  _targetId 
)
signal

Qt signal emitted when a variable is removed from the container.

Parameters
[in]_idUnique id of the variable pill.
[in]_targetIdUnique id of the target variable pill that this variable is removed from. VariablePill::EmptyVariable if it is removed from a container and not a variable pill.

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