libpappsomspp
Library for mass spectrometry
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.

34  : QPushButton(parent)
35 {
36  setSwitchValue(false);
37  setIconSize(QSize(40, 16));
38  setFlat(true);
39  setMaximumSize(40, 16);
40 
41  connect(this, &SwitchWidget::clicked, this, &SwitchWidget::updateSwitchValue);
42 }
void setSwitchValue(bool switch_value)
set the state of the switch button (on/off)

References setSwitchValue(), and updateSwitchValue().

◆ ~SwitchWidget()

pappso::SwitchWidget::~SwitchWidget ( )

Definition at line 44 of file switchbuttonwidget.cpp.

45 {
46 }

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.

65 {
66  return m_switchButtonValue;
67 }

◆ setSwitchValue()

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

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

Parameters
switch_valueboolean true or false

Definition at line 49 of file switchbuttonwidget.cpp.

50 {
51  m_switchButtonValue = switch_value;
53  {
54  setIcon(QIcon(":/icons/resources/icons/switch_on.svg"));
55  }
56  else
57  {
58  setIcon(QIcon(":/icons/resources/icons/switch_off.svg"));
59  }
60 }

Referenced by SwitchWidget().

◆ updateSwitchValue

void pappso::SwitchWidget::updateSwitchValue ( )
privateslot

Definition at line 70 of file switchbuttonwidget.cpp.

71 {
73 }

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: