Add a flashing event in the events bar when a ZT1 or ZT2 train passage is inhibited by CC (Modbus).

This commit is contained in:
jfmartel
2017-09-22 14:54:46 -04:00
parent 2f1ea1b5e5
commit a55770c693
12 changed files with 95 additions and 16 deletions
+18 -5
View File
@@ -34,13 +34,17 @@
#include "CDV.h"
#include <QPoint>
CEventItem::CEventItem(QString Label,bool Animated,QGraphicsItem *Parent)
CEventItem::CEventItem(QString Label, bool Animated, QGraphicsItem *Parent, int Color)
{
setParentItem(Parent);
// mCDVFreeBrush = new QBrush(Qt::gray);
// mCDVITICommandedBrush = new QBrush(Qt::darkGreen);
// mCDVOccupiedBrush = new QBrush(Qt::yellow);
if(Color != EVENT_ITEM_COLOR_RED && Color != EVENT_ITEM_COLOR_GREEN)
{
Color = EVENT_ITEM_COLOR_RED;
}
mColor = Color;
setGeometry(0,0,40,25);
mCurBrush = new QBrush(Qt::lightGray);
@@ -75,7 +79,16 @@ void CEventItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
QRectF EventRect = rect();
if(mAnimated)
mCurBrush->setColor(QColor(255,mAlpha,mAlpha,255));
{
if(mColor == EVENT_ITEM_COLOR_RED)
{
mCurBrush->setColor(QColor(255,mAlpha,mAlpha,255));
}
else
{
mCurBrush->setColor(QColor(mAlpha,255,mAlpha,255));
}
}
painter->setBrush(*mCurBrush);
painter->setPen(Qt::black);
+9 -1
View File
@@ -39,7 +39,14 @@ class CEventItem : public QGraphicsWidget
Q_OBJECT
public:
CEventItem(QString Label,bool Animated,QGraphicsItem *Parent = 0);
enum eEventColor
{
EVENT_ITEM_COLOR_RED,
EVENT_ITEM_COLOR_GREEN
};
CEventItem(QString Label,bool Animated,QGraphicsItem *Parent = 0, int Color = EVENT_ITEM_COLOR_RED);
~CEventItem();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
@@ -59,6 +66,7 @@ private:
bool mAnimated;
QTimeLine *mAnimationTimeline;
unsigned int mAlpha;
int mColor;
signals:
void EventItemRightClicked(CEventItem*);
+1 -1
View File
@@ -72,7 +72,7 @@ void CEventsBar::UpdateEventsList()
for(int i = 0; i < mEventsList->size(); i++)
{
CEventItem *NewItem = new CEventItem(mEventsList->at(i)->mEventLabel,mEventsList->at(i)->mItemAnimated,this);
CEventItem *NewItem = new CEventItem(mEventsList->at(i)->mEventLabel,mEventsList->at(i)->mItemAnimated,this,mEventsList->at(i)->mEventColor);
mEventsItemList.append(NewItem);
}
UpdateDisplay();