62 QGraphicsItem (_parent),
73 height_ = _image.height ();
76 QImage i = _image.scaled (
width_, height_, Qt::IgnoreAspectRatio, Qt::SmoothTransformation).convertToFormat (QImage::Format_ARGB32);
78 checkedPix_ = QPixmap::fromImage (i);
81 QImage normal (
width_, height_, QImage::Format_ARGB32);
82 QImage over (
width_, height_, QImage::Format_ARGB32);
84 for (
int x = 0; x <
width_; x++)
85 for (
int y = 0; y < height_; y++)
87 QRgb pix = i.pixel (x, y);
88 over.setPixel (x, y, qRgba (qRed (pix), qGreen (pix), qBlue (pix), qAlpha (pix) * 0.5));
89 normal.setPixel (x, y, qRgba (qGray (pix), qGray (pix), qGray (pix), qAlpha (pix) * 0.3));
91 overPix_ = QPixmap::fromImage (over);
94 setAcceptHoverEvents (
true);
108 _painter->setClipping (
false);
109 if (pressed_ || checked_)
110 _painter->drawPixmap (0, 0, checkedPix_);
112 _painter->drawPixmap (0, 0, overPix_);