From 3cb4b1ac995125f1fffe31bdb02ea4429a5ff5b9 Mon Sep 17 00:00:00 2001 From: KhalilSelyan Date: Fri, 17 May 2024 19:34:32 +0300 Subject: [PATCH] bigger padding + bold font text in custom button Signed-off-by: KhalilSelyan --- common/tier4_state_rviz_plugin/src/custom_button.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/custom_button.cpp b/common/tier4_state_rviz_plugin/src/custom_button.cpp index 71ff61c3bd6d0..b6ff82e4d9523 100644 --- a/common/tier4_state_rviz_plugin/src/custom_button.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_button.cpp @@ -7,6 +7,12 @@ CustomElevatedButton::CustomElevatedButton( setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); setCursor(Qt::PointingHandCursor); + // set font weight to bold and size to 12 + QFont font = this->font(); + font.setWeight(QFont::Bold); + font.setFamily("Roboto"); + setFont(font); + // Set up drop shadow effect QGraphicsDropShadowEffect * shadowEffect = new QGraphicsDropShadowEffect(this); shadowEffect->setBlurRadius(15); @@ -20,8 +26,8 @@ QSize CustomElevatedButton::sizeHint() const QFontMetrics fm(font()); int textWidth = fm.horizontalAdvance(text()); int textHeight = fm.height(); - int width = textWidth + 40; // Adding padding - int height = textHeight + 20; // Adding padding + int width = textWidth + 45; // Adding padding + int height = textHeight + 25; // Adding padding return QSize(width, height); }