| 32 | } |
| 33 | |
| 34 | void customIcon::paintEvent(QPaintEvent *event){ |
| 35 | resize(height() / widgetRatio, height()); |
| 36 | |
| 37 | QPainter bgPainter(this); |
| 38 | bgPainter.setRenderHints(QPainter::Antialiasing); |
| 39 | bgPainter.setPen(Qt::NoPen); |
| 40 | bgPainter.setBrush(bgColor); |
| 41 | bgPainter.drawRoundedRect(this->rect(), radius, radius); |
| 42 | |
| 43 | QPainter pixmapPainter(this); |
| 44 | pixmapPainter.setRenderHints(QPainter::Antialiasing); |
| 45 | pixmapPainter.translate(width() / 2, height() / 2); |
| 46 | pixmapPainter.rotate(rotation); |
| 47 | pixmapPainter.translate(-width() / 2, -height() / 2); |
| 48 | int w = iconSizeRate * width(); |
| 49 | int h = iconSizeRate * height(); |
| 50 | pixmapPainter.drawPixmap(width() / 2 - w / 2, height() / 2 - h / 2, w, h, *iconImg); |
| 51 | } |
| 52 | |
| 53 | void customIcon::enterEvent(QEnterEvent *event){ |
| 54 | bgColor = hoverColor; |
nothing calls this directly
no outgoing calls
no test coverage detected