apply button mapping

sceneinput
Marc Zinnschlag 9 years ago
parent 501ae6372d
commit 7bbc475bda

@ -9,6 +9,7 @@
#include <QDropEvent>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QApplication>
#include <osgGA/TrackballManipulator>
#include <osgGA/FirstPersonManipulator>
@ -394,6 +395,20 @@ osg::ref_ptr<CSVRender::TagBase> CSVRender::WorldspaceWidget::mousePick (QMouseE
return osg::ref_ptr<CSVRender::TagBase>();
}
std::string CSVRender::WorldspaceWidget::mapButton (QMouseEvent *event)
{
std::pair<Qt::MouseButton, bool> phyiscal (
event->button(), QApplication::keyboardModifiers() & Qt::ControlModifier);
std::map<std::pair<Qt::MouseButton, bool>, std::string>::const_iterator iter =
mButtonMapping.find (phyiscal);
if (iter!=mButtonMapping.end())
return iter->second;
return "";
}
void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event)
{
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
@ -480,9 +495,14 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
void CSVRender::WorldspaceWidget::mousePressEvent (QMouseEvent *event)
{
if (event->button() != Qt::RightButton)
return;
std::string button = mapButton (event);
if (button=="p-navi" || button=="s-navi")
{
}
else if (button=="p-edit" || button=="s-edit" || button=="select")
{
osg::ref_ptr<TagBase> tag = mousePick (event);
if (tag)
@ -494,6 +514,7 @@ void CSVRender::WorldspaceWidget::mousePressEvent (QMouseEvent *event)
object->setSelected (!object->getSelected());
}
}
}
}
void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)

@ -130,6 +130,8 @@ namespace CSVRender
osg::ref_ptr<TagBase> mousePick (QMouseEvent *event);
std::string mapButton (QMouseEvent *event);
virtual std::string getStartupInstruction() = 0;
private slots:

Loading…
Cancel
Save