#include "clockoverlay.h" #include ClockOverlay::ClockOverlay(QWidget* parent) : QLCDNumber(parent) { QPalette palette; palette.setColor(QPalette::Window, Qt::white ); palette.setColor(QPalette::WindowText, Qt::darkBlue ); palette.setColor(QPalette::Light, Qt::darkBlue ); //Light and dark are used for shadows when SegmentStyle is filled or Outline palette.setColor(QPalette::Dark, Qt::darkBlue ); //they are also used in the border this->setSegmentStyle( Flat ); this->setAutoFillBackground ( true ); this->setPalette(palette); } void ClockOverlay::timerTick() { QTime now = QTime::currentTime(); QString format = ( (now.second()%2)==0) ? "HH:mm" : "HH mm"; this->display( QTime::currentTime().toString(format) ); this->raise(); }