Commit cb280002 authored by Cory Quammen's avatar Cory Quammen
Browse files

Set the Alt key state in vtkRenderWindowInteractor

Control and shift key state was set in vtkRenderWindowInteractor
from QVTKInteractorAdapter, but the state of the alt key was not.
This patch addresses that oversight.

Hat tip to Mengda Wu <wumengda@gmail.com> for providing a patch
on the VTK users mailing list that describes the needed fix.
parent a00b89d9
Pipeline #18617 passed with stage
......@@ -112,6 +112,7 @@ bool QVTKInteractorAdapter::ProcessEvent(QEvent* e, vtkRenderWindowInteractor* i
(e2->modifiers() & Qt::ShiftModifier ) > 0 ? 1 : 0,
0,
e2->type() == QEvent::MouseButtonDblClick ? 1 : 0);
iren->SetAltKey((e2->modifiers() & Qt::AltModifier) > 0 ? 1 : 0);
if(t == QEvent::MouseMove)
{
......@@ -237,6 +238,7 @@ bool QVTKInteractorAdapter::ProcessEvent(QEvent* e, vtkRenderWindowInteractor* i
(e2->modifiers() & Qt::ControlModifier),
(e2->modifiers() & Qt::ShiftModifier),
ascii_key, e2->count(), keysym);
iren->SetAltKey((e2->modifiers() & Qt::AltModifier) > 0 ? 1 : 0);
if(t == QEvent::KeyPress)
{
......@@ -263,6 +265,7 @@ bool QVTKInteractorAdapter::ProcessEvent(QEvent* e, vtkRenderWindowInteractor* i
iren->SetEventInformationFlipY(e2->x(), e2->y(),
(e2->modifiers() & Qt::ControlModifier) > 0 ? 1 : 0,
(e2->modifiers() & Qt::ShiftModifier ) > 0 ? 1 : 0);
iren->SetAltKey((e2->modifiers() & Qt::AltModifier) > 0 ? 1 : 0);
this->AccumulatedDelta += e2->delta();
const int threshold = 120;
......@@ -299,6 +302,7 @@ bool QVTKInteractorAdapter::ProcessEvent(QEvent* e, vtkRenderWindowInteractor* i
iren->SetEventInformationFlipY(e2->x(), e2->y(),
(e2->modifiers() & Qt::ControlModifier) > 0 ? 1 : 0,
(e2->modifiers() & Qt::ShiftModifier ) > 0 ? 1 : 0);
iren->SetAltKey((e2->modifiers() & Qt::AltModifier) > 0 ? 1 : 0);
// invoke event and pass qt event for additional data as well
iren->InvokeEvent(QVTKInteractor::ContextMenuEvent, e2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment