#include "waterlevelicon.h" #include "define.h" #include "udphandler.h" WaterLevelIcon::WaterLevelIcon(QWidget *parent) : QLabel(parent) { #if MODEL_GRADE != 2 connect(&timer, SIGNAL(timeout()), SLOT(check())); timer.start(1000); check(); #endif } void WaterLevelIcon::check() { switch (UdpHandler::getInstance()->waterLevel()) { case 3: case 2: setPixmap(QPixmap(":/images/symbol/water_level_high.png")); break; case 1: setPixmap(QPixmap(":/images/symbol/water_level_middle.png")); break; case 0: setPixmap(QPixmap(":/images/symbol/water_level_low.png")); break; } }