pappso::SwitchWidget Class Reference

`#include <switchbuttonwidget.h>`

Inheritance diagram for pappso::SwitchWidget:

## Public Member Functions

| SwitchWidget (QWidget *parent=0)
| ~SwitchWidget ()
bool | getSwitchValue ()
| get the state of the switch button (on/off) More...
void | setSwitchValue (bool switch_value)
| set the state of the switch button (on/off) More...

## Private Slots

void | updateSwitchValue ()

## Private Attributes

bool | m_switchButtonValue = false

## Detailed Description

Definition at line 40 of file switchbuttonwidget.h.

## Constructor & Destructor Documentation

## SwitchWidget()

pappso::SwitchWidget::SwitchWidget | ( | QWidget * | parent = `0` | ) |

Definition at line 34 of file switchbuttonwidget.cpp.

: QPushButton(parent)
{
setSwitchValue(false);
setIconSize(QSize(40, 16));
setFlat(true);
setMaximumSize(40, 16);
connect(this, &SwitchWidget::clicked, this, &SwitchWidget::updateSwitchValue);
}
pappso::SwitchWidget::updateSwitchValue
void updateSwitchValue()
Definition: switchbuttonwidget.cpp:70
pappso::SwitchWidget::setSwitchValue
void setSwitchValue(bool switch_value)
set the state of the switch button (on/off)
Definition: switchbuttonwidget.cpp:49

References setSwitchValue(), and updateSwitchValue().

## ~SwitchWidget()

pappso::SwitchWidget::~SwitchWidget | ( |  | ) |

Definition at line 44 of file switchbuttonwidget.cpp.

{
}

## Member Function Documentation

## getSwitchValue()

bool pappso::SwitchWidget::getSwitchValue | ( |  | ) |

get the state of the switch button (on/off)

Returns
  boolean true or false

Definition at line 64 of file switchbuttonwidget.cpp.

{
return m_switchButtonValue;
}
pappso::SwitchWidget::m_switchButtonValue
bool m_switchButtonValue
Definition: switchbuttonwidget.h:61

## setSwitchValue()

void pappso::SwitchWidget::setSwitchValue | ( | bool | switch_value | ) |

set the state of the switch button (on/off)

Parameters

  switch_value | boolean true or false

Definition at line 49 of file switchbuttonwidget.cpp.

{
m_switchButtonValue = switch_value;
if(m_switchButtonValue)
{
setIcon(QIcon(":/icons/resources/icons/switch_on.svg"));
}
else
{
setIcon(QIcon(":/icons/resources/icons/switch_off.svg"));
}
}

Referenced by SwitchWidget().

## updateSwitchValue

void pappso::SwitchWidget::updateSwitchValue | ( |  | ) |

private slot

Definition at line 70 of file switchbuttonwidget.cpp.

{
setSwitchValue(!m_switchButtonValue);
}

Referenced by SwitchWidget().

## Member Data Documentation

## m_switchButtonValue

bool pappso::SwitchWidget::m_switchButtonValue = false

private

Definition at line 61 of file switchbuttonwidget.h.

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

- pappsomspp/widget/switchbuttonwidget/switchbuttonwidget.h
- pappsomspp/widget/switchbuttonwidget/switchbuttonwidget.cpp