MCPcopy Create free account
hub / github.com/Linloir/GraphBuilder / paintEvent

Method paintEvent

customWidgets.cpp:34–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void 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
53void customIcon::enterEvent(QEnterEvent *event){
54 bgColor = hoverColor;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected