void ClockWidget::drawClockWidget() { _clock_bg = QImage(prefix + "background.png"); /*gloss stuff*/ gloss = QImage(prefix + "gloss.png"); //gloss.convertDepth (32); // gloss.setAlphaBuffer (true); face = QPixmap(prefix + "face.png"); thedot = QPixmap(prefix + "thedot.png"); //date = QPixmap(prefix+"date_field.png"); /**seconds first **/ _secs_hand = QPixmap().fromImage(QImage(prefix + "second-hand-long.png")); sec_timer = new QTimer(this); connect(sec_timer, SIGNAL(timeout()), this, SLOT(drawSeconds())); sec_timer->start(1000); /** Mins after that **/ _mins_hand = QPixmap().fromImage(QImage(prefix + "second-hand.png")); _hour_hand = QPixmap().fromImage(QImage(prefix + "second-hand.png")); /**Createsa a nice Lense**/ /** Prerender into Qimage to save Processing in Painter event**/ double rad = ((face.width() / 2)) - 8.0; int offset = 28; QRect bounds(0, 0, face.width() - offset, face.height() - offset); QPainter p; lens = QImage(QSize(face.width() - offset, face.height() - offset), QImage::Format_ARGB32_Premultiplied); lens.fill(0); p.begin(&lens); QRadialGradient gr(rad, rad, rad, 3 * rad / 5, 3 * rad / 5); gr.setColorAt(0.0, QColor(255, 255, 255, 191)); gr.setColorAt(0.2, QColor(255, 255, 231, 191)); gr.setColorAt(0.9, QColor(150, 150, 200, 65)); gr.setColorAt(0.95, QColor(0, 0, 0, 0)); gr.setColorAt(1, QColor(0, 0, 0, 0)); p.setRenderHint(QPainter::Antialiasing); p.setBrush(gr); p.setPen(Qt::NoPen); p.drawEllipse(0, 0, bounds.width(), bounds.height()); p.end(); }
void drawTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t tenths, uint16_t color, uint8_t tenthsmode){ if (tenthsmode == 1) drawTenths(tenths, color); drawSeconds(seconds, color); drawMinutes(minutes, color); drawHours(hours, minutes, color); }