Skip to content

Commit c59041f

Browse files
author
KhalilSelyan
committed
refactor: improve disabled custom button appearance
Signed-off-by: KhalilSelyan <khalil@leodrive.ai>
1 parent 5bc6eed commit c59041f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

common/tier4_state_rviz_plugin/src/custom_button.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,22 @@ void CustomElevatedButton::paintEvent(QPaintEvent *)
9696
// Draw button background
9797
QPainterPath backgroundPath;
9898
backgroundPath.addRoundedRect(r, cornerRadius, cornerRadius);
99-
painter.setBrush(buttonColor);
99+
if (!isEnabled()) {
100+
painter.setBrush(
101+
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));
102+
painter.setOpacity(0.12);
103+
} else {
104+
painter.setBrush(buttonColor);
105+
}
100106
painter.setPen(Qt::NoPen);
101107
painter.drawPath(backgroundPath);
102108

103109
// Draw button text
104-
painter.setPen(currentTextColor);
105-
painter.drawText(r, Qt::AlignCenter, text());
106-
107110
if (!isEnabled()) {
108-
painter.setBrush(
109-
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));
110-
painter.setPen(Qt::NoPen);
111-
painter.setOpacity(0.12);
112-
painter.drawPath(backgroundPath);
111+
painter.setOpacity(0.38);
113112
}
113+
painter.setPen(currentTextColor);
114+
painter.drawText(r, Qt::AlignCenter, text());
114115
}
115116

116117
void CustomElevatedButton::enterEvent(QEvent * event)

0 commit comments

Comments
 (0)