| 52 | EditorChatButton::~EditorChatButton() = default; |
| 53 | |
| 54 | void EditorChatButton::paintEvent(QPaintEvent *) |
| 55 | { |
| 56 | QPainter painter(this); |
| 57 | painter.setRenderHint(QPainter::Antialiasing); |
| 58 | |
| 59 | QColor bgColor = m_backgroundColor; |
| 60 | if (m_isPressed) { |
| 61 | bgColor = bgColor.darker(120); |
| 62 | } else if (m_isHovered) { |
| 63 | bgColor = bgColor.lighter(110); |
| 64 | } |
| 65 | painter.fillRect(rect(), bgColor); |
| 66 | |
| 67 | QRect buttonRect = rect().adjusted(4, 4, -4, -4); |
| 68 | painter.setPen(Qt::NoPen); |
| 69 | QColor buttonBgColor |
| 70 | = m_isPressed ? Utils::creatorTheme()->color(Utils::Theme::BackgroundColorHover).darker(110) |
| 71 | : Utils::creatorTheme()->color(Utils::Theme::BackgroundColorHover); |
| 72 | |
| 73 | if (m_isHovered) { |
| 74 | buttonBgColor = buttonBgColor.lighter(110); |
| 75 | } |
| 76 | painter.setBrush(buttonBgColor); |
| 77 | painter.drawEllipse(buttonRect); |
| 78 | |
| 79 | if (!m_logoPixmap.isNull()) { |
| 80 | QRect logoRect( |
| 81 | (width() - m_logoPixmap.width()) / 2, |
| 82 | (height() - m_logoPixmap.height()) / 2, |
| 83 | m_logoPixmap.width(), |
| 84 | m_logoPixmap.height()); |
| 85 | painter.drawPixmap(logoRect, m_logoPixmap); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | void EditorChatButton::mousePressEvent(QMouseEvent *event) |
| 90 | { |
nothing calls this directly
no outgoing calls
no test coverage detected