MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / drawEffectShadow

Method drawEffectShadow

ElaWidgetTools/ElaTheme.cpp:33–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void ElaTheme::drawEffectShadow(QPainter* painter, const QRect& widgetRect, int shadowBorderWidth, int borderRadius)
34{
35 Q_D(ElaTheme);
36 painter->save();
37 painter->setRenderHints(QPainter::Antialiasing);
38 QPainterPath path;
39 path.setFillRule(Qt::WindingFill);
40 QColor color = d->_themeMode == ElaThemeType::Light ? QColor(0x70, 0x70, 0x70) : QColor(0x9C, 0x9B, 0x9E);
41 for (int i = 0; i < shadowBorderWidth; i++)
42 {
43 path.addRoundedRect(widgetRect.x() + shadowBorderWidth - i, widgetRect.y() + shadowBorderWidth - i, widgetRect.width() - (shadowBorderWidth - i) * 2, widgetRect.height() - (shadowBorderWidth - i) * 2, borderRadius + i, borderRadius + i);
44 int alpha = 1 * (shadowBorderWidth - i + 1);
45 color.setAlpha(alpha > 255 ? 255 : alpha);
46 painter->setPen(color);
47 painter->drawPath(path);
48 }
49 painter->restore();
50}
51
52void ElaTheme::setThemeColor(ElaThemeType::ThemeMode themeMode, ElaThemeType::ThemeColor themeColor, const QColor& newColor)
53{

Callers 14

paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
drawControlMethod · 0.80
paintEventMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected