#include "frmpilot.h" #include "ui_frmpilot.h" #include "quihelper.h" frmPilot::frmPilot(QWidget *parent) : QWidget(parent), ui(new Ui::frmPilot) { ui->setupUi(this); this->initForm(); } frmPilot::~frmPilot() { delete ui; } void frmPilot::initForm() { QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(setValue())); timer->start(500); setValue(); } void frmPilot::setValue() { static int flag = 0; if (flag == 0) { ui->widget->setLightGreen(); flag = 1; } else if (flag == 1) { ui->widget->setLightRed(); flag = 2; } else if (flag == 2) { ui->widget->setYellow(); flag = 0; } }