MCPcopy Create free account
hub / github.com/KDE/okular / createOpacityIcon

Function createOpacityIcon

gui/guiutils.cpp:330–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330QIcon createOpacityIcon(qreal opacity)
331{
332 QIcon opacityIcon;
333
334 // Create a pixmap for each common icon size.
335 for (int size : {16, 22, 24, 32, 48}) {
336 QPixmap pixmap(QSize(size, size) * qApp->devicePixelRatio());
337 pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
338 pixmap.fill(Qt::transparent);
339 QPainter painter(&pixmap);
340 painter.setPen(Qt::NoPen);
341 painter.setBrush(qApp->palette().color(QPalette::Active, QPalette::WindowText));
342
343 // Checkerboard pattern
344 painter.drawRect(QRectF(QPoint(0, 0), QPoint(size, size) / 2));
345 painter.drawRect(QRectF(QPoint(size, size) / 2, QPoint(size, size)));
346
347 // Opacity
348 painter.setOpacity(opacity);
349 painter.drawRect(QRect(QPoint(0, 0), QPoint(size, size)));
350
351 painter.end();
352 opacityIcon.addPixmap(pixmap);
353 }
354
355 return opacityIcon;
356}
357
358}

Callers 2

parseToolMethod · 0.85

Calls 7

QPointClass · 0.85
fillMethod · 0.80
setOpacityMethod · 0.80
QSizeClass · 0.70
QRectClass · 0.70
colorMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected