#include "waterlevelicon.h" #include "udphandler.h" WaterLevelIcon::WaterLevelIcon(QWidget *parent) : QLabel(parent) { connect(&timer, SIGNAL(timeout()), SLOT(check())); timer.start(1000); check(); } 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; } }