Image Component Library (ICL)
Classes | Public Member Functions | Protected Slots | Private Attributes | Friends | List of all members
icl::qt::ThreadedUpdatableSlider Class Reference

Compability class. More...

#include <ThreadedUpdatableSlider.h>

Inheritance diagram for icl::qt::ThreadedUpdatableSlider:

Classes

struct  CB
 internally callback type More...
 

Public Member Functions

 ThreadedUpdatableSlider (QWidget *parent=0)
 Base constructor. More...
 
 ThreadedUpdatableSlider (Qt::Orientation o, QWidget *parent=0)
 
void setValueFromOtherThread (int value)
 call this function to update a widget's UI from an external thread More...
 
void setStepping (int stepping)
 the given stepping is automatically clipped to [1,...] More...
 
virtual bool event (QEvent *event)
 automatically called by Qt's event processing mechanism More...
 
void registerCallback (const utils::Function< void > &cb, const std::string &events="value")
 registers a void-callback function to the given event names More...
 
void removeCallbacks ()
 removes all callbacks associated to this slider component More...
 

Protected Slots

void collectValueChanged (int)
 for collecting slider singnals More...
 
void collectSliderPressed ()
 for collecting slider singnals More...
 
void collectSliderMoved (int)
 for collecting slider singnals More...
 
void collectSliderReleased ()
 for collecting slider singnals More...
 

Private Attributes

std::vector< CBcallbacks
 internal list of callbacks More...
 
int m_stepping
 

Friends

struct EventFilter
 

Detailed Description

Compability class.

This class provides a compability function for asyncronous updating of a QWidget. As QWidget::update() has shown to be not as threadsafe as expected, the new updateFromOtherThread function fixes this problem.

updateFromOtherThread used QApplication::postEvent, to post a UserType QEvent to this object, which is caught in the overloaded event() function

Constructor & Destructor Documentation

◆ ThreadedUpdatableSlider() [1/2]

icl::qt::ThreadedUpdatableSlider::ThreadedUpdatableSlider ( QWidget *  parent = 0)

Base constructor.

◆ ThreadedUpdatableSlider() [2/2]

icl::qt::ThreadedUpdatableSlider::ThreadedUpdatableSlider ( Qt::Orientation  o,
QWidget *  parent = 0 
)

Member Function Documentation

◆ collectSliderMoved

void icl::qt::ThreadedUpdatableSlider::collectSliderMoved ( int  )
protectedslot

for collecting slider singnals

◆ collectSliderPressed

void icl::qt::ThreadedUpdatableSlider::collectSliderPressed ( )
protectedslot

for collecting slider singnals

◆ collectSliderReleased

void icl::qt::ThreadedUpdatableSlider::collectSliderReleased ( )
protectedslot

for collecting slider singnals

◆ collectValueChanged

void icl::qt::ThreadedUpdatableSlider::collectValueChanged ( int  )
protectedslot

for collecting slider singnals

◆ event()

virtual bool icl::qt::ThreadedUpdatableSlider::event ( QEvent *  event)
virtual

automatically called by Qt's event processing mechanism

◆ registerCallback()

void icl::qt::ThreadedUpdatableSlider::registerCallback ( const utils::Function< void > &  cb,
const std::string &  events = "value" 
)

registers a void-callback function to the given event names

allowed event names are

  • press (when the slider is pressed)
  • release (when the slider is released)
  • move (when the slider is moved)
  • value (when the value is changed)
  • all (for all events)

◆ removeCallbacks()

void icl::qt::ThreadedUpdatableSlider::removeCallbacks ( )

removes all callbacks associated to this slider component

◆ setStepping()

void icl::qt::ThreadedUpdatableSlider::setStepping ( int  stepping)
inline

the given stepping is automatically clipped to [1,...]

◆ setValueFromOtherThread()

void icl::qt::ThreadedUpdatableSlider::setValueFromOtherThread ( int  value)
inline

call this function to update a widget's UI from an external thread

new, if this is called from the GUI thread, setValue is called directly without using Qt's signal mechanism

Friends And Related Function Documentation

◆ EventFilter

friend struct EventFilter
friend

Member Data Documentation

◆ callbacks

std::vector<CB> icl::qt::ThreadedUpdatableSlider::callbacks
private

internal list of callbacks

◆ m_stepping

int icl::qt::ThreadedUpdatableSlider::m_stepping
private

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