mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed mouse wheel in Qt5.
This commit is contained in:
parent
162dc42800
commit
49a01189dc
1 changed files with 4 additions and 6 deletions
|
@ -304,12 +304,6 @@ void lcQGLWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
|
||||||
void lcQGLWidget::wheelEvent(QWheelEvent *event)
|
void lcQGLWidget::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (event->orientation() != Qt::Vertical)
|
|
||||||
{
|
|
||||||
event->ignore();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float scale = deviceScale();
|
float scale = deviceScale();
|
||||||
|
|
||||||
widget->mInputState.x = event->x() * scale;
|
widget->mInputState.x = event->x() * scale;
|
||||||
|
@ -318,7 +312,11 @@ void lcQGLWidget::wheelEvent(QWheelEvent *event)
|
||||||
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
|
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
|
||||||
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
|
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
||||||
|
int numDegrees = event->angleDelta() / 8;
|
||||||
|
#else
|
||||||
int numDegrees = event->delta() / 8;
|
int numDegrees = event->delta() / 8;
|
||||||
|
#endif
|
||||||
int numSteps = numDegrees / 15;
|
int numSteps = numDegrees / 15;
|
||||||
|
|
||||||
widget->OnMouseWheel(numSteps);
|
widget->OnMouseWheel(numSteps);
|
||||||
|
|
Loading…
Reference in a new issue