Image Component Library (ICL)
|
Utility class to avoid Qt warning when accesing QLabels from differnt Threads. More...
#include <ColorLabel.h>
Public Member Functions | |
ColorLabel (core::Color4D &color, bool useAlpha, QWidget *parent=0) | |
Create a new label with given text and given parent widget. | |
virtual void | paintEvent (QPaintEvent *evt) |
reimplemented drawin function (draw the current text centered) | |
void | setColor (const core::Color &color) |
sets new color rgb | |
void | setColor (const core::Color4D &color) |
sets new color rgba | |
core::Color | getRGB () const |
returns current color | |
core::Color4D | getRGBA () const |
returns current rgba color | |
int | getRed () const |
returns current red value | |
int | getGreen () const |
returns current green value | |
int | getBlue () const |
returns current blue value | |
int | getAlhpa () const |
return current alpha value | |
bool | hasAlpha () const |
returns wheter internal color uses alpha value | |
Private Attributes | |
core::Color4D & | m_color |
shallowly wrapped color | |
bool | m_hasAlpha |
indicator wheter alpha is used | |
QMutex | m_oMutex |
Thread-safety mutex. |
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.
icl::qt::ColorLabel::ColorLabel | ( | core::Color4D & | color, |
bool | useAlpha, | ||
QWidget * | parent = 0 |
||
) |
Create a new label with given text and given parent widget.
int icl::qt::ColorLabel::getAlhpa | ( | ) | const |
return current alpha value
int icl::qt::ColorLabel::getBlue | ( | ) | const |
returns current blue value
int icl::qt::ColorLabel::getGreen | ( | ) | const |
returns current green value
int icl::qt::ColorLabel::getRed | ( | ) | const |
returns current red value
core::Color icl::qt::ColorLabel::getRGB | ( | ) | const |
returns current color
core::Color4D icl::qt::ColorLabel::getRGBA | ( | ) | const |
returns current rgba color
bool icl::qt::ColorLabel::hasAlpha | ( | ) | const |
returns wheter internal color uses alpha value
virtual void icl::qt::ColorLabel::paintEvent | ( | QPaintEvent * | evt | ) | [virtual] |
reimplemented drawin function (draw the current text centered)
void icl::qt::ColorLabel::setColor | ( | const core::Color & | color | ) |
sets new color rgb
void icl::qt::ColorLabel::setColor | ( | const core::Color4D & | color | ) |
sets new color rgba
core::Color4D& icl::qt::ColorLabel::m_color [private] |
shallowly wrapped color
bool icl::qt::ColorLabel::m_hasAlpha [private] |
indicator wheter alpha is used
QMutex icl::qt::ColorLabel::m_oMutex [mutable, private] |
Thread-safety mutex.