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()

VariablePill ( QWidget *  _parent = nullptr)
explicit

Constructor.

Parameters
[in]_parentPointer to a parent widget

◆ ~VariablePill()

virtual ~VariablePill ( )
virtual

Destructor.

Member Function Documentation

◆ AddVariablePill()

void AddVariablePill ( VariablePill _variable)

Add a child variable pill.

This becomes a multi-variable pill.

Parameters
[in]_variableChild variable pill to add.

◆ Container()

VariablePillContainer* Container ( ) const

Get the container which holds this variable pill.

Returns
_container Container that holds this variable pill.

◆ ContainsPoint()

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.

◆ 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.

◆ Id()

unsigned int Id ( ) const

Get the unique id of this variable pill.

Returns
Unique id;

◆ IsSelected()

bool IsSelected ( ) const

Return the selected state of this variable pill.

Returns
Selected state.

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  _event)
protected

Qt mouse press event.

Parameters
[in]_eventQt mouse event.

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  _event)
protected

Qt mouse move event.

Parameters
[in]_eventQt mouse event.

◆ Name()

std::string Name ( ) const

Get the unique name for this variable.

Returns
Name for this variable

◆ Parent()

VariablePill* Parent ( ) const

Get the parent of this variable pill.

Returns
Parent variable pill.

◆ RemoveVariablePill()

void RemoveVariablePill ( VariablePill _variable)

Remove a child variable pill.

Parameters
[in]_variableChild variable pill to remove.

◆ SetContainer()

void SetContainer ( VariablePillContainer _container)

Set the container which holds this variable pill.

Parameters
[in]_containerContainer to hold this variable pill.

◆ SetName()

void SetName ( const std::string &  _name)

Set a unique name for this variable.

Parameters
[in]_nameName of the variable.

◆ SetParent()

void SetParent ( VariablePill _parent)

Set the parent of this variable pill.

Parameters
[in]_parentParent variable pill.

◆ SetSelected()

void SetSelected ( const bool  _selected)

Set the selected state of this variable pill.

Parameters
[in]_selectedTrue to set the state to be selected.

◆ SetText()

void SetText ( const std::string &  _text)

Set the text label for this variable pill.

Parameters
[in]_textText to set the label to.

◆ Text()

std::string Text ( ) const

Get the text label for this variable pill.

Returns
the text label.

◆ VariableAdded

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.

◆ VariableLabelChanged

void VariableLabelChanged ( const std::string &  _label)
signal

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

Parameters
[in]_labelNew variable label.

◆ VariableMoved

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.

◆ VariablePillByName()

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.

◆ VariablePillCount()

unsigned int VariablePillCount ( ) const

Get the number of child variable pills.

Returns
Number of child variable pills.

◆ VariablePills()

std::map<unsigned int, VariablePill *>& VariablePills ( ) const

Get the a child variable pill.

Parameters
[in]_indexIndex of the child variable pill.

◆ VariableRemoved

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

◆ EmptyVariable

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: