Image Component Library (ICL)
Public Member Functions | Private Attributes | List of all members
icl::qt::ColorLabel Class Reference

Utility class to avoid Qt warning when accesing QLabels from differnt Threads. More...

#include <ColorLabel.h>

Inheritance diagram for icl::qt::ColorLabel:
icl::qt::ThreadedUpdatableWidget

Public Member Functions

 ColorLabel (core::Color4D &color, bool useAlpha, QWidget *parent=0)
 Create a new label with given text and given parent widget. More...
 
virtual void paintEvent (QPaintEvent *evt)
 reimplemented drawin function (draw the current text centered) More...
 
void setColor (const core::Color &color)
 sets new color rgb More...
 
void setColor (const core::Color4D &color)
 sets new color rgba More...
 
core::Color getRGB () const
 returns current color More...
 
core::Color4D getRGBA () const
 returns current rgba color More...
 
int getRed () const
 returns current red value More...
 
int getGreen () const
 returns current green value More...
 
int getBlue () const
 returns current blue value More...
 
int getAlhpa () const
 return current alpha value More...
 
bool hasAlpha () const
 returns wheter internal color uses alpha value More...
 
- Public Member Functions inherited from icl::qt::ThreadedUpdatableWidget
 ThreadedUpdatableWidget (QWidget *parent=0)
 Base constructor. More...
 
void updateFromOtherThread ()
 call this function to update a widget's UI from an external thread More...
 
virtual bool event (QEvent *event)
 automatically called by Qt's event processing mechanism More...
 

Private Attributes

core::Color4Dm_color
 shallowly wrapped color More...
 
bool m_hasAlpha
 indicator wheter alpha is used More...
 
QMutex m_oMutex
 Thread-safety mutex. More...
 

Detailed Description

Utility class to avoid Qt warning when accesing QLabels from differnt Threads.

QLabels can not be used from different Threads. So if a QLabel is created in in the main thread, it might not be set up to show another text/number from the working thread. As a workaround, the "label" component of the ICL GUI API uses not the original QLabel but this thread-save reimplementation called CompabilityLabel.

Constructor & Destructor Documentation

◆ ColorLabel()

icl::qt::ColorLabel::ColorLabel ( core::Color4D color,
bool  useAlpha,
QWidget *  parent = 0 
)

Create a new label with given text and given parent widget.

Member Function Documentation

◆ getAlhpa()

int icl::qt::ColorLabel::getAlhpa ( ) const

return current alpha value

◆ getBlue()

int icl::qt::ColorLabel::getBlue ( ) const

returns current blue value

◆ getGreen()

int icl::qt::ColorLabel::getGreen ( ) const

returns current green value

◆ getRed()

int icl::qt::ColorLabel::getRed ( ) const

returns current red value

◆ getRGB()

core::Color icl::qt::ColorLabel::getRGB ( ) const

returns current color

◆ getRGBA()

core::Color4D icl::qt::ColorLabel::getRGBA ( ) const

returns current rgba color

◆ hasAlpha()

bool icl::qt::ColorLabel::hasAlpha ( ) const

returns wheter internal color uses alpha value

◆ paintEvent()

virtual void icl::qt::ColorLabel::paintEvent ( QPaintEvent *  evt)
virtual

reimplemented drawin function (draw the current text centered)

◆ setColor() [1/2]

void icl::qt::ColorLabel::setColor ( const core::Color color)

sets new color rgb

◆ setColor() [2/2]

void icl::qt::ColorLabel::setColor ( const core::Color4D color)

sets new color rgba

Member Data Documentation

◆ m_color

core::Color4D& icl::qt::ColorLabel::m_color
private

shallowly wrapped color

◆ m_hasAlpha

bool icl::qt::ColorLabel::m_hasAlpha
private

indicator wheter alpha is used

◆ m_oMutex

QMutex icl::qt::ColorLabel::m_oMutex
mutableprivate

Thread-safety mutex.


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