QtPdWidgets  2.3.1
Classes | Public Types | Public Member Functions | Properties | Private Slots | Private Member Functions | Private Attributes | List of all members
Pd::PushButton Class Reference

Push Button. More...

#include <PushButton.h>

Inheritance diagram for Pd::PushButton:
Inheritance graph
[legend]
Collaboration diagram for Pd::PushButton:
Collaboration graph
[legend]

Classes

struct  Impl
 

Public Types

enum  ButtonMode { PressRelease, Event }
 Push button behaviour. More...
 
enum  EventCondition { OnClicked, OnPressed, OnReleased }
 Event condition, determines when an event is generated. More...
 
enum  EventAction { IncrementValue, SetOnValue, ToggleValue }
 Event action, determines what happens, when an event is generated. More...
 

Public Member Functions

 PushButton (QWidget *parent=0)
 Constructor. More...
 
virtual ~PushButton ()
 Destructor. More...
 
void clearData ()
 
ButtonMode getButtonMode () const
 
void setButtonMode (ButtonMode)
 Sets the buttonMode. More...
 
void resetButtonMode ()
 Resets the buttonMode. More...
 
EventCondition getEventCondition () const
 
void setEventCondition (EventCondition)
 Sets the eventCondition. More...
 
void resetEventCondition ()
 Resets the eventCondition. More...
 
EventAction getEventAction () const
 
void setEventAction (EventAction)
 Sets the eventAction. More...
 
void resetEventAction ()
 Resets the eventAction. More...
 
int getOnValue () const
 
void setOnValue (int)
 Sets the onValue. More...
 
void resetOnValue ()
 Resets the onValue. More...
 
int getOffValue () const
 
void setOffValue (int)
 Sets the offValue. More...
 
void resetOffValue ()
 Resets the offValue. More...
 

Properties

ButtonMode buttonMode
 
EventCondition eventCondition
 
EventAction eventAction
 
int onValue
 
int offValue
 

Private Slots

PD_PRIVATE void on_clicked ()
 The button has been clicked. More...
 
PD_PRIVATE void on_pressed ()
 The button is pressed down. More...
 
PD_PRIVATE void on_released ()
 The button is released. More...
 

Private Member Functions

PD_PRIVATE void changeEvent (QEvent *) override
 This function executes the action specified in eventAction. More...
 
PD_PRIVATE void newValues (std::chrono::nanoseconds) override
 This virtual method is called by the ProcessVariable, if its value changes. More...
 

Private Attributes

struct PD_PRIVATE Impl
 
std::unique_ptr< Implimpl
 

Detailed Description

Push Button.

Todo:
Event mode with value checking.

Member Enumeration Documentation

◆ ButtonMode

Push button behaviour.

Enumerator
PressRelease 

The onValue is written when the button is pressed down, the offValue is written when releasing it, respectively.

Event 

An event is generated, based on EventCondition and EventAction settings.

◆ EventAction

Event action, determines what happens, when an event is generated.

Enumerator
IncrementValue 

The value of the process variable is incremented.

SetOnValue 

The onValue is written to the process variable.

ToggleValue 

The offValue is written to the process if the last value was the onValue.

Otherwise the onValue is written to the process.

◆ EventCondition

Event condition, determines when an event is generated.

Enumerator
OnClicked 

Event generated by QPushButton's clicked() signal (button is pressed and released, while the cursor is inside the button area.

OnPressed 

Event generated by QPushButton's pressed() signal (button just pressed down).

OnReleased 

Event generated by QPushButton's released() signal (button released, regardless of cursor being inside the button area).

Consider using OnClicked.

Constructor & Destructor Documentation

◆ PushButton()

PushButton::PushButton ( QWidget *  parent = 0)

Constructor.

Parameters
parentparent widget

References Impl.

◆ ~PushButton()

PushButton::~PushButton ( )
virtual

Destructor.

Member Function Documentation

◆ changeEvent()

void PushButton::changeEvent ( QEvent *  event)
overrideprivate

This function executes the action specified in eventAction.

References impl, and on_released().

◆ clearData()

void PushButton::clearData ( )

◆ getButtonMode()

PushButton::ButtonMode PushButton::getButtonMode ( ) const
Returns
The buttonMode.

References impl.

◆ getEventAction()

PushButton::EventAction PushButton::getEventAction ( ) const
Returns
The eventAction.

References impl.

◆ getEventCondition()

PushButton::EventCondition PushButton::getEventCondition ( ) const
Returns
The eventCondition.

References impl.

◆ getOffValue()

int PushButton::getOffValue ( ) const
Returns
The offValue.

References impl.

◆ getOnValue()

int PushButton::getOnValue ( ) const
Returns
The onValue.

References impl.

◆ newValues()

void PushButton::newValues ( std::chrono::nanoseconds  )
overrideprivate

This virtual method is called by the ProcessVariable, if its value changes.

References impl, and PressRelease.

◆ on_clicked

void PushButton::on_clicked ( )
privateslot

The button has been clicked.

This is the case, when the user presses the button and releases it with the curser inside the button area.

References Event, impl, OnClicked, and PressRelease.

◆ on_pressed

void PushButton::on_pressed ( )
privateslot

The button is pressed down.

References Event, impl, OnPressed, and PressRelease.

◆ on_released

void PushButton::on_released ( )
privateslot

The button is released.

References Event, impl, OnReleased, and PressRelease.

Referenced by changeEvent(), and setButtonMode().

◆ resetButtonMode()

void PushButton::resetButtonMode ( )

Resets the buttonMode.

References DEFAULT_BUTTONMODE, and setButtonMode().

◆ resetEventAction()

void PushButton::resetEventAction ( )

Resets the eventAction.

References DEFAULT_EVENTACTION, and setEventAction().

◆ resetEventCondition()

void PushButton::resetEventCondition ( )

◆ resetOffValue()

void PushButton::resetOffValue ( )

Resets the offValue.

References DEFAULT_OFFVALUE, and setOffValue().

◆ resetOnValue()

void PushButton::resetOnValue ( )

Resets the onValue.

References DEFAULT_ONVALUE, and setOnValue().

◆ setButtonMode()

void PushButton::setButtonMode ( ButtonMode  m)

Sets the buttonMode.

If the button is currently pressed down and the button is in PressRelease mode (very rare), an released() signal is generated.

References impl, on_released(), and PressRelease.

Referenced by resetButtonMode().

◆ setEventAction()

void PushButton::setEventAction ( EventAction  a)

Sets the eventAction.

References impl.

Referenced by resetEventAction().

◆ setEventCondition()

void PushButton::setEventCondition ( EventCondition  c)

Sets the eventCondition.

References impl.

Referenced by resetEventCondition().

◆ setOffValue()

void PushButton::setOffValue ( int  v)

Sets the offValue.

References impl.

Referenced by resetOffValue().

◆ setOnValue()

void PushButton::setOnValue ( int  v)

Sets the onValue.

References impl.

Referenced by resetOnValue().

Member Data Documentation

◆ Impl

Referenced by PushButton().

◆ impl

std::unique_ptr<Impl> Pd::PushButton::impl
private

Property Documentation

◆ buttonMode

ButtonMode Pd::PushButton::buttonMode
readwrite

◆ eventAction

EventAction Pd::PushButton::eventAction
readwrite

◆ eventCondition

EventCondition Pd::PushButton::eventCondition
readwrite

◆ offValue

int Pd::PushButton::offValue
readwrite

◆ onValue

int Pd::PushButton::onValue
readwrite

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