This PR fixes issues on systems where `QCursor::setPos()` has no effect or is not reliable. These issues included knobs moving to fast on some operating systems. Affected widgets are `Knob` and `LcdSpinBox`. With this PR, on all operating systems, the `setPos` calls are removed and the cursor is not hidden anymore, so the mouse keeps moving normally when changing values of one of the widgets. As now the previous pointer position keeps moving (instead of being reset to the original position using `QCursor::setPos`), the mathematics that translate pointer pixel distance to `Knob`/`LcdSpinBox` value increase have to be changed: * The `Knob` transition function is now linear and uses a new factor. * `LcdSpinBox` now uses float values and saves the current float remainder (this is actually a separate issue revealed by this fix), leading to a fluent, non hanging movement.
This commit is contained in:
@@ -174,8 +174,7 @@ private:
|
||||
BoolModel m_volumeKnob;
|
||||
FloatModel m_volumeRatio;
|
||||
|
||||
QPoint m_mouseOffset;
|
||||
QPoint m_origMousePos;
|
||||
QPoint m_lastMousePos; //!< mouse position in last mouseMoveEvent
|
||||
float m_leftOver;
|
||||
bool m_buttonPressed;
|
||||
|
||||
|
||||
@@ -73,8 +73,9 @@ protected:
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * _me );
|
||||
|
||||
private:
|
||||
float m_remainder; //!< floating offset of spinbox in [-0.5, 0.5]
|
||||
bool m_mouseMoving;
|
||||
QPoint m_origMousePos;
|
||||
QPoint m_lastMousePos; //!< mouse position in last mouseMoveEvent
|
||||
int m_displayOffset;
|
||||
void enterValue();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user