MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / paintEvent

Method paintEvent

widgets/EditorChatButton.cpp:54–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52EditorChatButton::~EditorChatButton() = default;
53
54void 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
89void EditorChatButton::mousePressEvent(QMouseEvent *event)
90{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected