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. 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::Color4D & | m_color |
shallowly wrapped color More... | |
bool | m_hasAlpha |
indicator wheter alpha is used More... | |
QMutex | m_oMutex |
Thread-safety mutex. More... | |
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 |
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
|
private |
shallowly wrapped color
|
private |
indicator wheter alpha is used
|
mutableprivate |
Thread-safety mutex.