fix for multicolor LED, still not solved: LED in list view not working
This commit is contained in:
parent
58cb051a14
commit
cfa6891b5b
2 changed files with 26 additions and 38 deletions
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CMultiColorLEDbase::CMultiColorLEDbase ( QWidget* parent, Qt::WindowFlags f )
|
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
||||||
: QLabel ( parent, f ),
|
: QLabel ( parent, f ),
|
||||||
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeGreen ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
BitmCubeRed ( LED_WIDTH_HEIGHT_SIZE_PIXEL, LED_WIDTH_HEIGHT_SIZE_PIXEL ),
|
||||||
|
@ -46,8 +46,13 @@ CMultiColorLEDbase::CMultiColorLEDbase ( QWidget* parent, Qt::WindowFlags f )
|
||||||
// init color flags
|
// init color flags
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
|
// set modified style of label
|
||||||
|
setFrameShape ( QFrame::Panel );
|
||||||
|
setFrameShadow ( QFrame::Sunken );
|
||||||
|
setIndent ( 0 );
|
||||||
|
|
||||||
// set init bitmap
|
// set init bitmap
|
||||||
SetPixmap ( BitmCubeGrey );
|
setPixmap ( BitmCubeGrey );
|
||||||
eColorFlag = RL_GREY;
|
eColorFlag = RL_GREY;
|
||||||
|
|
||||||
// init update time
|
// init update time
|
||||||
|
@ -62,7 +67,7 @@ CMultiColorLEDbase::CMultiColorLEDbase ( QWidget* parent, Qt::WindowFlags f )
|
||||||
this, SLOT ( OnTimerYellowLight() ) );
|
this, SLOT ( OnTimerYellowLight() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::Reset()
|
void CMultiColorLED::Reset()
|
||||||
{
|
{
|
||||||
// reset color flags
|
// reset color flags
|
||||||
bFlagRedLi = false;
|
bFlagRedLi = false;
|
||||||
|
@ -72,25 +77,25 @@ void CMultiColorLEDbase::Reset()
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::OnTimerRedLight()
|
void CMultiColorLED::OnTimerRedLight()
|
||||||
{
|
{
|
||||||
bFlagRedLi = false;
|
bFlagRedLi = false;
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::OnTimerGreenLight()
|
void CMultiColorLED::OnTimerGreenLight()
|
||||||
{
|
{
|
||||||
bFlagGreenLi = false;
|
bFlagGreenLi = false;
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::OnTimerYellowLight()
|
void CMultiColorLED::OnTimerYellowLight()
|
||||||
{
|
{
|
||||||
bFlagYellowLi = false;
|
bFlagYellowLi = false;
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::UpdateColor()
|
void CMultiColorLED::UpdateColor()
|
||||||
{
|
{
|
||||||
/* Red light has highest priority, then comes yellow and at the end, we
|
/* Red light has highest priority, then comes yellow and at the end, we
|
||||||
decide to set green light. Allways check the current color of the
|
decide to set green light. Allways check the current color of the
|
||||||
|
@ -99,7 +104,7 @@ void CMultiColorLEDbase::UpdateColor()
|
||||||
{
|
{
|
||||||
if ( eColorFlag != RL_RED )
|
if ( eColorFlag != RL_RED )
|
||||||
{
|
{
|
||||||
SetPixmap ( BitmCubeRed );
|
setPixmap ( BitmCubeRed );
|
||||||
eColorFlag = RL_RED;
|
eColorFlag = RL_RED;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +114,7 @@ void CMultiColorLEDbase::UpdateColor()
|
||||||
{
|
{
|
||||||
if ( eColorFlag != RL_YELLOW )
|
if ( eColorFlag != RL_YELLOW )
|
||||||
{
|
{
|
||||||
SetPixmap ( BitmCubeYellow );
|
setPixmap ( BitmCubeYellow );
|
||||||
eColorFlag = RL_YELLOW;
|
eColorFlag = RL_YELLOW;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -119,7 +124,7 @@ void CMultiColorLEDbase::UpdateColor()
|
||||||
{
|
{
|
||||||
if ( eColorFlag != RL_GREEN )
|
if ( eColorFlag != RL_GREEN )
|
||||||
{
|
{
|
||||||
SetPixmap ( BitmCubeGreen );
|
setPixmap ( BitmCubeGreen );
|
||||||
eColorFlag = RL_GREEN;
|
eColorFlag = RL_GREEN;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -128,12 +133,12 @@ void CMultiColorLEDbase::UpdateColor()
|
||||||
// if no color is active, set control to grey light
|
// if no color is active, set control to grey light
|
||||||
if ( eColorFlag != RL_GREY )
|
if ( eColorFlag != RL_GREY )
|
||||||
{
|
{
|
||||||
SetPixmap ( BitmCubeGrey );
|
setPixmap ( BitmCubeGrey );
|
||||||
eColorFlag = RL_GREY;
|
eColorFlag = RL_GREY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::SetLight ( const int iNewStatus )
|
void CMultiColorLED::SetLight ( const int iNewStatus )
|
||||||
{
|
{
|
||||||
switch ( iNewStatus )
|
switch ( iNewStatus )
|
||||||
{
|
{
|
||||||
|
@ -159,7 +164,7 @@ void CMultiColorLEDbase::SetLight ( const int iNewStatus )
|
||||||
UpdateColor();
|
UpdateColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMultiColorLEDbase::SetUpdateTime ( const int iNUTi )
|
void CMultiColorLED::SetUpdateTime ( const int iNUTi )
|
||||||
{
|
{
|
||||||
// avoid too short intervals
|
// avoid too short intervals
|
||||||
if ( iNUTi < MIN_TIME_FOR_RED_LIGHT )
|
if ( iNUTi < MIN_TIME_FOR_RED_LIGHT )
|
||||||
|
@ -171,13 +176,3 @@ void CMultiColorLEDbase::SetUpdateTime ( const int iNUTi )
|
||||||
iUpdateTime = iNUTi;
|
iUpdateTime = iNUTi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CMultiColorLED::CMultiColorLED ( QWidget* parent, Qt::WindowFlags f )
|
|
||||||
: CMultiColorLEDbase ( parent, f )
|
|
||||||
{
|
|
||||||
// set modified style
|
|
||||||
setFrameShape ( QFrame::Panel );
|
|
||||||
setFrameShadow ( QFrame::Sunken );
|
|
||||||
setIndent ( 0 );
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Copyright (c) 2004-2006
|
* Copyright (c) 2004-2008
|
||||||
*
|
*
|
||||||
* Author(s):
|
* Author(s):
|
||||||
* Volker Fischer
|
* Volker Fischer
|
||||||
|
@ -49,12 +49,12 @@
|
||||||
|
|
||||||
|
|
||||||
/* Classes ********************************************************************/
|
/* Classes ********************************************************************/
|
||||||
class CMultiColorLEDbase : public QLabel
|
class CMultiColorLED : public QLabel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CMultiColorLEDbase ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
CMultiColorLED ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
void SetUpdateTime ( const int iNUTi );
|
void SetUpdateTime ( const int iNUTi );
|
||||||
|
@ -64,7 +64,6 @@ protected:
|
||||||
enum ELightColor { RL_GREY, RL_RED, RL_GREEN, RL_YELLOW };
|
enum ELightColor { RL_GREY, RL_RED, RL_GREEN, RL_YELLOW };
|
||||||
ELightColor eColorFlag;
|
ELightColor eColorFlag;
|
||||||
|
|
||||||
virtual void SetPixmap ( QPixmap& NewBitmap ) {} // must be implemented in derived class
|
|
||||||
void UpdateColor();
|
void UpdateColor();
|
||||||
|
|
||||||
QPixmap BitmCubeGreen;
|
QPixmap BitmCubeGreen;
|
||||||
|
@ -89,17 +88,11 @@ protected slots:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CMultiColorLED : public CMultiColorLEDbase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CMultiColorLED ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void SetPixmap ( QPixmap& NewBitmap ) { setPixmap ( NewBitmap ); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CMultColLEDListViewItem : public CMultiColorLEDbase
|
// TODO list view item LED does not work anymore
|
||||||
|
|
||||||
|
class CMultColLEDListViewItem : public CMultiColorLED
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMultColLEDListViewItem ( const int iNewCol ) : iColumn ( iNewCol ),
|
CMultColLEDListViewItem ( const int iNewCol ) : iColumn ( iNewCol ),
|
||||||
|
|
Loading…
Reference in a new issue