mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 15:41:13 -04:00
apply button mapping
This commit is contained in:
parent
501ae6372d
commit
7bbc475bda
@ -9,6 +9,7 @@
|
|||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include <osgGA/TrackballManipulator>
|
#include <osgGA/TrackballManipulator>
|
||||||
#include <osgGA/FirstPersonManipulator>
|
#include <osgGA/FirstPersonManipulator>
|
||||||
@ -394,6 +395,20 @@ osg::ref_ptr<CSVRender::TagBase> CSVRender::WorldspaceWidget::mousePick (QMouseE
|
|||||||
return osg::ref_ptr<CSVRender::TagBase>();
|
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)
|
void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event)
|
||||||
{
|
{
|
||||||
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
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)
|
void CSVRender::WorldspaceWidget::mousePressEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() != Qt::RightButton)
|
std::string button = mapButton (event);
|
||||||
return;
|
|
||||||
|
|
||||||
|
if (button=="p-navi" || button=="s-navi")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (button=="p-edit" || button=="s-edit" || button=="select")
|
||||||
|
{
|
||||||
osg::ref_ptr<TagBase> tag = mousePick (event);
|
osg::ref_ptr<TagBase> tag = mousePick (event);
|
||||||
|
|
||||||
if (tag)
|
if (tag)
|
||||||
@ -495,6 +515,7 @@ void CSVRender::WorldspaceWidget::mousePressEvent (QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
|
void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +130,8 @@ namespace CSVRender
|
|||||||
|
|
||||||
osg::ref_ptr<TagBase> mousePick (QMouseEvent *event);
|
osg::ref_ptr<TagBase> mousePick (QMouseEvent *event);
|
||||||
|
|
||||||
|
std::string mapButton (QMouseEvent *event);
|
||||||
|
|
||||||
virtual std::string getStartupInstruction() = 0;
|
virtual std::string getStartupInstruction() = 0;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user