Mercurial > hg > svgui
comparison widgets/Thumbwheel.cpp @ 1303:13f5f84fbfad
Collect the bits of bookkeeping for mouse wheel events, and use in all widgets
author | Chris Cannam |
---|---|
date | Fri, 22 Jun 2018 17:19:48 +0100 |
parents | a34a2a25907c |
children | c8a6fd3f9dff |
comparison
equal
deleted
inserted
replaced
1302:f3d3fab250ac | 1303:13f5f84fbfad |
---|---|
424 } | 424 } |
425 | 425 |
426 void | 426 void |
427 Thumbwheel::wheelEvent(QWheelEvent *e) | 427 Thumbwheel::wheelEvent(QWheelEvent *e) |
428 { | 428 { |
429 int step = int(lrintf(m_speed)); | 429 int delta = m_wheelCounter.count(e); |
430 if (step == 0) step = 1; | 430 |
431 | 431 if (delta == 0) { |
432 if (e->delta() > 0) { | 432 return; |
433 setValue(m_value + step); | 433 } |
434 } else { | 434 |
435 setValue(m_value - step); | 435 setValue(m_value + delta); |
436 } | |
437 | |
438 emit valueChanged(getValue()); | 436 emit valueChanged(getValue()); |
439 } | 437 } |
440 | 438 |
441 void | 439 void |
442 Thumbwheel::paintEvent(QPaintEvent *) | 440 Thumbwheel::paintEvent(QPaintEvent *) |