From 843225996cc4d8573be7d4a70b71333ab2baf319 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 27 Oct 2015 15:43:52 +0100 Subject: [PATCH] get modifiers from event instead of from the application --- apps/opencs/view/render/pagedworldspacewidget.cpp | 6 +++--- apps/opencs/view/render/pagedworldspacewidget.hpp | 2 +- apps/opencs/view/render/worldspacewidget.cpp | 10 +++++----- apps/opencs/view/render/worldspacewidget.hpp | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index 6e5c2587d..dae5990e6 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -150,7 +150,7 @@ void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons ( "terrain-move"); } -void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr tag, const std::string& button) +void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr tag, const std::string& button, bool shift) { if (tag && tag->getElement()==Element_CellArrow) { @@ -178,7 +178,7 @@ void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr t bool modified = false; - if (QApplication::keyboardModifiers() & Qt::ShiftModifier) + if (shift) { if (button=="p-edit") addCellSelection (x, y); @@ -217,7 +217,7 @@ void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr t } } - WorldspaceWidget::handleMouseClick (tag, button); + WorldspaceWidget::handleMouseClick (tag, button, shift); } void CSVRender::PagedWorldspaceWidget::referenceableDataChanged (const QModelIndex& topLeft, diff --git a/apps/opencs/view/render/pagedworldspacewidget.hpp b/apps/opencs/view/render/pagedworldspacewidget.hpp index e1a43ba7c..e983fddd5 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.hpp +++ b/apps/opencs/view/render/pagedworldspacewidget.hpp @@ -102,7 +102,7 @@ namespace CSVRender virtual void addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool); - virtual void handleMouseClick (osg::ref_ptr tag, const std::string& button); + virtual void handleMouseClick (osg::ref_ptr tag, const std::string& button, bool shift); signals: diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 3f4b77383..46c5867eb 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -413,7 +413,7 @@ osg::ref_ptr CSVRender::WorldspaceWidget::mousePick (QMouseE std::string CSVRender::WorldspaceWidget::mapButton (QMouseEvent *event) { std::pair phyiscal ( - event->button(), QApplication::keyboardModifiers() & Qt::ControlModifier); + event->button(), event->modifiers() & Qt::ControlModifier); std::map, std::string>::const_iterator iter = mButtonMapping.find (phyiscal); @@ -548,7 +548,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event) double factor = mDragFactor; - if (QApplication::keyboardModifiers() & Qt::ShiftModifier) + if (event->modifiers() & Qt::ShiftModifier) factor *= mDragShiftFactor; EditMode& editMode = dynamic_cast (*mEditMode->getCurrent()); @@ -593,7 +593,7 @@ void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event) { osg::ref_ptr tag = mousePick (event); - handleMouseClick (tag, button); + handleMouseClick (tag, button, event->modifiers() & Qt::ShiftModifier); } } @@ -614,7 +614,7 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event) { double factor = mDragWheelFactor; - if (QApplication::keyboardModifiers() & Qt::ShiftModifier) + if (event->modifiers() & Qt::ShiftModifier) factor *= mDragShiftFactor; EditMode& editMode = dynamic_cast (*mEditMode->getCurrent()); @@ -639,7 +639,7 @@ void CSVRender::WorldspaceWidget::keyPressEvent (QKeyEvent *event) RenderWidget::keyPressEvent(event); } -void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr tag, const std::string& button) +void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr tag, const std::string& button, bool shift) { EditMode& editMode = dynamic_cast (*mEditMode->getCurrent()); diff --git a/apps/opencs/view/render/worldspacewidget.hpp b/apps/opencs/view/render/worldspacewidget.hpp index fe766cf87..c2d61e75b 100644 --- a/apps/opencs/view/render/worldspacewidget.hpp +++ b/apps/opencs/view/render/worldspacewidget.hpp @@ -133,7 +133,8 @@ namespace CSVRender virtual void wheelEvent (QWheelEvent *event); virtual void keyPressEvent (QKeyEvent *event); - virtual void handleMouseClick (osg::ref_ptr tag, const std::string& button); + virtual void handleMouseClick (osg::ref_ptr tag, const std::string& button, + bool shift); private: