30 #include <QMouseEvent> 50 QColor col(Qt::green);
97 cerr <<
"LEDButton(" <<
this <<
")::mousePressEvent" << endl;
99 if (e->buttons() & Qt::LeftButton) {
101 bool newState =
state();
102 SVDEBUG <<
"emitting new state " << newState << endl;
129 int width = this->width();
132 if (width > this->height())
133 width = this->height();
142 if (
d->
on_map->size() == size()) {
144 paint.drawPixmap(0, 0, *
d->
on_map);
156 paint.drawPixmap(0, 0, *
d->
off_map);
169 tmpMap =
new QPixmap(width, width);
170 tmpMap->fill(palette().background().
color());
173 paint.setRenderHint(QPainter::Antialiasing,
true);
180 brush.setStyle(Qt::SolidPattern);
181 brush.setColor(
color);
182 paint.setBrush(brush);
185 paint.drawEllipse( scale, scale, width - scale*2, width - scale*2 );
192 pen.setWidth( 2 * scale );
195 int pos = width/5 + 1;
196 int light_width = width;
201 int light_quote = (130*2/(light_width?light_width:1))+100;
204 while (light_width) {
206 pen.setColor(
color );
208 paint.drawEllipse( pos, pos, light_width, light_width );
212 paint.drawEllipse( pos, pos, light_width, light_width );
216 paint.drawEllipse( pos, pos, light_width, light_width );
217 pos++; light_width--;
225 pen.setWidth(2 * scale);
226 brush.setStyle(Qt::NoBrush);
227 paint.setBrush(brush);
233 color = palette().light().color();
235 for (
int arc = 120; arc < 2880; arc += 240) {
238 int w = width - pen.width()/2 - scale + 1;
239 paint.drawArc(pen.width()/2 + 1, pen.width()/2 + 1, w - 2, w - 2, angle + arc, 240);
240 paint.drawArc(pen.width()/2 + 1, pen.width()/2 + 1, w - 2, w - 2, angle - arc, 240);
252 QImage i = tmpMap->toImage();
255 dest =
new QPixmap(QPixmap::fromImage
256 (i.scaled(width, width,
258 Qt::SmoothTransformation)));
266 paint.drawPixmap(0, 0, *dest);
351 return QSize(17, 17);
357 return QSize(17, 17);