Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes
icl::qt::CompabilityLabel Class Reference

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

#include <CompabilityLabel.h>

Inheritance diagram for icl::qt::CompabilityLabel:
icl::qt::ThreadedUpdatableWidget

List of all members.

Public Member Functions

 CompabilityLabel (const QString &text, 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 setNum (int i)
 make the label show an integer value
void setNum (float f)
 make the label show a float value
void setText (const QString &text)
 make the lable show a given string
QString text () const
 returns the current text (also thread save)
Qt::Alignment getAlignment () const
 returns current alignment
void setAlignment (Qt::Alignment a)
 sets new text alignment

Private Attributes

QString m_sText
 current text (protected by the mutex)
Qt::Alignment m_alignment
 text alignment
QMutex m_oMutex
 Thread-safety mutex.

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

icl::qt::CompabilityLabel::CompabilityLabel ( const QString &  text,
QWidget *  parent = 0 
)

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


Member Function Documentation

Qt::Alignment icl::qt::CompabilityLabel::getAlignment ( ) const

returns current alignment

virtual void icl::qt::CompabilityLabel::paintEvent ( QPaintEvent *  evt) [virtual]

reimplemented drawin function (draw the current text centered)

void icl::qt::CompabilityLabel::setAlignment ( Qt::Alignment  a)

sets new text alignment

make the label show an integer value

make the label show a float value

void icl::qt::CompabilityLabel::setText ( const QString &  text)

make the lable show a given string

returns the current text (also thread save)


Member Data Documentation

Qt::Alignment icl::qt::CompabilityLabel::m_alignment [private]

text alignment

QMutex icl::qt::CompabilityLabel::m_oMutex [mutable, private]

Thread-safety mutex.

current text (protected by the mutex)


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines