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.
 
void VariableLabelChanged (const unsigned int _id, const std::string &_label)
 Qt signal emitted when a variable label has changed.
 
void VariableMoved (const unsigned int _id, const unsigned int _targetId)
 Qt signal emitted when a variable is moved into the container.
 
void VariableRemoved (const unsigned int _id, const unsigned int _targetId)
 Qt signal emitted when a variable is removed from the container.
 

Public Member Functions

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

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *_evt)
 Used to accept drag enter events.
 
void dropEvent (QDropEvent *_evt)
 Used to accept drop events.
 
virtual void keyPressEvent (QKeyEvent *_event)
 Qt callback when a key is pressed.
 
void mouseReleaseEvent (QMouseEvent *_event)
 Qt callback when the mouse is released.
 

Detailed Description

A container for holding variable pills.

Constructor & Destructor Documentation

◆ VariablePillContainer()

VariablePillContainer ( QWidget * _parent = nullptr)
explicit

Constructor.

Parameters
[in]_parentPointer to a parent widget

◆ ~VariablePillContainer()

virtual ~VariablePillContainer ( )
virtual

Destructor.

Member Function Documentation

◆ AddVariablePill() [1/2]

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.

◆ AddVariablePill() [2/2]

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.

◆ dragEnterEvent()

void dragEnterEvent ( QDragEnterEvent * _evt)
protected

Used to accept drag enter events.

Parameters
[in]_evtThe drag event.

◆ dropEvent()

void dropEvent ( QDropEvent * _evt)
protected

Used to accept drop events.

Parameters
[in]_evtThe drop event.

◆ GetVariablePill()

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.

◆ keyPressEvent()

virtual void keyPressEvent ( QKeyEvent * _event)
protectedvirtual

Qt callback when a key is pressed.

Parameters
[in]_eventQt key event.

◆ MaxSize()

int MaxSize ( ) const

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

Returns
Maximum number of variable pills. -1 means unlimited.

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent * _event)
protected

Qt callback when the mouse is released.

Parameters
[in]_eventQt mouse event.

◆ RemoveVariablePill() [1/2]

void RemoveVariablePill ( const unsigned int _id)

Remove a variable pill from the container.

Parameters
[in]_idUnique id of the variable pill to remove.

◆ RemoveVariablePill() [2/2]

void RemoveVariablePill ( VariablePill * _variable)

Remove a variable pill from the container.

Parameters
[in]_variableVariable pill to remove.

◆ SetMaxSize()

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.

◆ SetSelected()

void SetSelected ( VariablePill * _variable)

Set the selected state of a variable pill.

Parameters
[in]_variableVariable pill to set the selected state.

◆ SetText()

void SetText ( const std::string & _text)

Set the label text for this variable pill container.

Parameters
[in]_textText to set the label to.

◆ SetVariablePillLabel()

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.

◆ Text()

std::string Text ( ) const

Get the variable pill container's label text.

Returns
Container label.

◆ VariableAdded

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.

◆ VariableLabelChanged

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.

◆ VariableMoved

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.

◆ VariablePillCount()

unsigned int VariablePillCount ( ) const

Get the number of child variable pills.

Returns
Number of child variable pills.

◆ VariableRemoved

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: