Skip to content

Commit

Permalink
thicker track and longer handle slider
Browse files Browse the repository at this point in the history
Signed-off-by: KhalilSelyan <[email protected]>
  • Loading branch information
KhalilSelyan committed May 17, 2024
1 parent 68c2c31 commit b758423
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions common/tier4_state_rviz_plugin/src/custom_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void CustomSlider::paintEvent(QPaintEvent *)
QRect handleRect =
style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);

int trackThickness = 10;
int trackThickness = 14;
int gap = 8;

QRect beforeRect(
Expand All @@ -46,12 +46,12 @@ void CustomSlider::paintEvent(QPaintEvent *)
centerY - trackThickness / 2);

// Straight line to right side start
beforePath.lineTo(beforeRect.right() - trackThickness * 0.2, centerY - trackThickness / 2);
beforePath.lineTo(beforeRect.right() - trackThickness * 0.1, centerY - trackThickness / 2);

// Right side with 20% roundedness
beforePath.quadTo(beforeRect.right(), centerY - trackThickness / 2, beforeRect.right(), centerY);
beforePath.quadTo(
beforeRect.right(), centerY + trackThickness / 2, beforeRect.right() - trackThickness * 0.2,
beforeRect.right(), centerY + trackThickness / 2, beforeRect.right() - trackThickness * 0.1,
centerY + trackThickness / 2);

// Close the path to the left side
Expand All @@ -64,19 +64,19 @@ void CustomSlider::paintEvent(QPaintEvent *)
QPainterPath afterPath;
afterPath.moveTo(afterRect.left(), centerY + trackThickness / 2);
afterPath.quadTo(
afterRect.left(), centerY - trackThickness / 2, afterRect.left() + trackThickness * 0.2,
afterRect.left(), centerY - trackThickness / 2, afterRect.left() + trackThickness * 0.1,
centerY - trackThickness / 2);
afterPath.lineTo(afterRect.right() - trackThickness * 0.5, centerY - trackThickness / 2);
afterPath.quadTo(afterRect.right(), centerY - trackThickness / 2, afterRect.right(), centerY);
afterPath.quadTo(
afterRect.right(), centerY + trackThickness / 2, afterRect.right() - trackThickness * 0.5,
centerY + trackThickness / 2);
afterPath.lineTo(afterRect.left() + trackThickness * 0.2, centerY + trackThickness / 2);
afterPath.lineTo(afterRect.left() + trackThickness * 0.1, centerY + trackThickness / 2);
afterPath.quadTo(afterRect.left(), centerY + trackThickness / 2, afterRect.left(), centerY);
painter.fillPath(afterPath, inactiveTrackColor);

painter.setBrush(QColor("#8bd0f0"));
int handleLineHeight = 25;
int handleLineHeight = 30;
int handleLineWidth = 4;
int handleLineRadius = 2;
QRect handleLineRect(
Expand Down

0 comments on commit b758423

Please sign in to comment.