Blame view

app/gui/oven_control/commicon.cpp 687 Bytes
0da128bb8   김태훈   상태 영역에 제어 보드 통신 상...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #include "commicon.h"
  
  #include <QPainter>
  #include <QPaintEvent>
  
  #include "udphandler.h"
  
  CommIcon::CommIcon(QWidget *parent) : QWidget(parent)
  {
      isFault = false;
  
      UdpHandler *udp = UdpHandler::getInstance();
      connect(udp, SIGNAL(timeout()), SLOT(setFault()));
      connect(udp, SIGNAL(recovered()), SLOT(setOK()));
  }
  
  void CommIcon::setFault()
  {
      isFault = true;
      update();
  }
  
  void CommIcon::setOK()
  {
      isFault = false;
      update();
  }
  
  void CommIcon::paintEvent(QPaintEvent *event)
  {
      if (isFault)
          return;
  
      QPainter painter(this);
      painter.setRenderHint(QPainter::Antialiasing);
      painter.setBrush(Qt::blue);
      painter.drawEllipse(rect());
  }