Skip to content

Commit

Permalink
[ui] Improve combobox behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Nov 4, 2024
1 parent 68fc704 commit c0f727c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/score/graphics/widgets/QGraphicsCombo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ struct DefaultComboImpl
if((event->buttons() & Qt::LeftButton) && self.m_grab)
{
double v = InfiniteScroller::move(event);
int curPos = v * (self.array.size() - 1);
int curPos = std::round(v * (self.array.size() - 1));
if(curPos != self.m_value)
{
self.m_value = curPos;
self.m_value = std::clamp(curPos, 0, int(self.array.size() - 1));
self.sliderMoved();
self.update();
}
Expand All @@ -128,10 +128,10 @@ struct DefaultComboImpl
if(self.m_grab)
{
double v = InfiniteScroller::move(event);
int curPos = v * (self.array.size() - 1);
int curPos = std::round(v * (self.array.size() - 1));
if(curPos != self.m_value)
{
self.m_value = curPos;
self.m_value = std::clamp(curPos, 0, int(self.array.size() - 1));
self.update();
}
self.m_grab = false;
Expand Down

0 comments on commit c0f727c

Please sign in to comment.