get modifiers from event instead of from the application

openmw-37
Marc Zinnschlag 9 years ago
parent d2e92fd36f
commit 843225996c

@ -150,7 +150,7 @@ void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
"terrain-move");
}
void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button)
void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button, bool shift)
{
if (tag && tag->getElement()==Element_CellArrow)
{
@ -178,7 +178,7 @@ void CSVRender::PagedWorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> 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<TagBase> t
}
}
WorldspaceWidget::handleMouseClick (tag, button);
WorldspaceWidget::handleMouseClick (tag, button, shift);
}
void CSVRender::PagedWorldspaceWidget::referenceableDataChanged (const QModelIndex& topLeft,

@ -102,7 +102,7 @@ namespace CSVRender
virtual void addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool);
virtual void handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button);
virtual void handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button, bool shift);
signals:

@ -413,7 +413,7 @@ osg::ref_ptr<CSVRender::TagBase> CSVRender::WorldspaceWidget::mousePick (QMouseE
std::string CSVRender::WorldspaceWidget::mapButton (QMouseEvent *event)
{
std::pair<Qt::MouseButton, bool> phyiscal (
event->button(), QApplication::keyboardModifiers() & Qt::ControlModifier);
event->button(), event->modifiers() & Qt::ControlModifier);
std::map<std::pair<Qt::MouseButton, bool>, 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<CSVRender::EditMode&> (*mEditMode->getCurrent());
@ -593,7 +593,7 @@ void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
{
osg::ref_ptr<TagBase> 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<CSVRender::EditMode&> (*mEditMode->getCurrent());
@ -639,7 +639,7 @@ void CSVRender::WorldspaceWidget::keyPressEvent (QKeyEvent *event)
RenderWidget::keyPressEvent(event);
}
void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button)
void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button, bool shift)
{
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());

@ -133,7 +133,8 @@ namespace CSVRender
virtual void wheelEvent (QWheelEvent *event);
virtual void keyPressEvent (QKeyEvent *event);
virtual void handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button);
virtual void handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button,
bool shift);
private:

Loading…
Cancel
Save