Skip to content

Commit 8219e18

Browse files
author
KhalilSelyan
committed
make segmented button a bit shorter
Signed-off-by: KhalilSelyan <khalil@leodrive.ai>
1 parent 03c7fc1 commit 8219e18

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

common/tier4_state_rviz_plugin/src/custom_segmented_button.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ CustomSegmentedButton::CustomSegmentedButton(QWidget * parent)
99
layout->setContentsMargins(0, 0, 0, 0); // Ensure no margins around the layout
1010
layout->setSpacing(0); // Ensure no spacing between buttons
1111

12+
// can we give the component left and right margins ? not the stuff inside of it
13+
1214
setLayout(layout);
1315

1416
buttonGroup->setExclusive(true);
@@ -34,7 +36,7 @@ QButtonGroup * CustomSegmentedButton::getButtonGroup() const
3436

3537
QSize CustomSegmentedButton::sizeHint() const
3638
{
37-
return QSize(400, 45); // Adjust the size hint as needed
39+
return QSize(400, 40); // Adjust the size hint as needed
3840

3941
// return QSize(
4042
// layout->count() * (layout->itemAt(0)->widget()->width()),
@@ -53,7 +55,8 @@ void CustomSegmentedButton::paintEvent(QPaintEvent *)
5355

5456
// Draw background
5557
QPainterPath path;
56-
path.addRoundedRect(rect(), height() / 2, height() / 2);
58+
QRectF rect = this->rect().adjusted(1, 0, -1, 0);
59+
path.addRoundedRect(rect, height() / 2, height() / 2);
5760

5861
painter.setPen(QPen(QColor("#8a9297"), 3));
5962
painter.setBrush(QColor("#0F1417"));

0 commit comments

Comments
 (0)