Skip to content

Commit

Permalink
InlineSlider: fix no background on middle
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStevns committed Nov 9, 2024
1 parent 38ff332 commit d5216b3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/src/inlineslider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,20 @@ void InlineSlider::drawSlider()

painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);

// Fill out the remaining part with some background color
painter.fillRect(borderRect,
option.palette.base());

// // Draw the filled part of the slider
switch (mSliderOrigin) {
case SliderStartPosType::LEFT:
{
painter.fillRect(borderRect,
brush);

// Fill out the remaining part with nothing
painter.fillRect(QRectF(mSliderPos,
painter.fillRect(QRectF(borderRect.left(),
borderRect.top(),
borderRect.right(),
mSliderPos,
borderRect.bottom()),
option.palette.base());
brush);
break;
}
case SliderStartPosType::MIDDLE:
Expand All @@ -155,8 +156,11 @@ void InlineSlider::drawSlider()
borderRect.center().x() - mSliderPos - mCaretWidth,
borderRect.height()),
brush);

painter.save();
painter.setPen(option.palette.text().color());

// Draw center line
painter.drawLine(QPointF(borderRect.center().x() - mCaretWidth, borderRect.top()),
QPointF(borderRect.center().x() - mCaretWidth, borderRect.bottom()));
painter.restore();
Expand Down

0 comments on commit d5216b3

Please sign in to comment.