Skip to content

Commit

Permalink
vc/xypad: fix vertical range slider on macOs (fix #1569)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed May 30, 2024
1 parent 539be44 commit 0ce5c5b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ui/src/ctkrangeslider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,18 @@ ctkRangeSliderPrivate::Handle ctkRangeSliderPrivate::handleAtPos(const QPoint& p
option.sliderPosition = this->m_MinimumPosition;
option.sliderValue = this->m_MinimumValue;

QStyle::SubControl minimumControl = q->style()->hitTestComplexControl(QStyle::CC_Slider, &option, pos, q);
//QStyle::SubControl minimumControl = q->style()->hitTestComplexControl(QStyle::CC_Slider, &option, pos, q);
QRect minimumHandleRect = q->style()->subControlRect(QStyle::CC_Slider, &option, QStyle::SC_SliderHandle, q);

// Test if the pos is under the Maximum handle
option.sliderPosition = this->m_MaximumPosition;
option.sliderValue = this->m_MaximumValue;

QStyle::SubControl maximumControl = q->style()->hitTestComplexControl(QStyle::CC_Slider, &option, pos, q);
//QStyle::SubControl maximumControl = q->style()->hitTestComplexControl(QStyle::CC_Slider, &option, pos, q);
QRect maximumHandleRect = q->style()->subControlRect(QStyle::CC_Slider, &option, QStyle::SC_SliderHandle, q);

// The pos is above both handles, select the closest handle
/*
if (minimumControl == QStyle::SC_SliderHandle &&
maximumControl == QStyle::SC_SliderHandle)
{
Expand All @@ -171,13 +172,13 @@ ctkRangeSliderPrivate::Handle ctkRangeSliderPrivate::handleAtPos(const QPoint& p
Q_ASSERT(minDist >= 0 && maxDist >= 0);
minimumControl = minDist < maxDist ? minimumControl : QStyle::SC_None;
}

if (minimumControl == QStyle::SC_SliderHandle)
*/
if (minimumHandleRect.contains(pos))
{
handleRect = minimumHandleRect;
return MinimumHandle;
}
else if (maximumControl == QStyle::SC_SliderHandle)
else if (maximumHandleRect.contains(pos))
{
handleRect = maximumHandleRect;
return MaximumHandle;
Expand Down

0 comments on commit 0ce5c5b

Please sign in to comment.