| 83 | |
| 84 | painter.save(); |
| 85 | QRect foregroundRect(1, 1, width() - 2, height() - 2); |
| 86 | QStyleOption option; |
| 87 | option.initFrom(this); |
| 88 | option.state.setFlag(QStyle::State_Sunken, d->_isPressed); |
| 89 | const QColor background = ElaControlStyle::getControlBackgroundColor(d->_themeMode, option.state, d->_isToggled); |
| 90 | painter.setPen(QPen(ElaControlStyle::getControlBorder(foregroundRect, d->_themeMode, isEnabled() && !d->_isPressed), 1)); |
| 91 | painter.setBrush(ElaColorAnimation::getColor(this, background)); |
| 92 | painter.drawRoundedRect(foregroundRect, d->_pBorderRadius, d->_pBorderRadius); |
| 93 | //文字绘制 |
| 94 | painter.setPen(isEnabled() ? d->_isToggled ? ElaThemeColor(d->_themeMode, BasicTextInvert) : ElaThemeColor(d->_themeMode, BasicText) : ElaThemeColor(d->_themeMode, BasicTextDisable)); |
| 95 | painter.drawText(foregroundRect, Qt::AlignCenter, d->_pText); |
| 96 | painter.restore(); |
| 97 | } |
nothing calls this directly
no outgoing calls
no test coverage detected