diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 2dfa66a12..dd2ec1bdd 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -44,6 +44,7 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg , mDragging (false) , mDragX(0) , mDragY(0) + , mSpeedMode(false) , mDragFactor(0) , mDragWheelFactor(0) , mDragShiftFactor(0) @@ -97,8 +98,10 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg CSMPrefs::get()["Tooltips"].update(); // Shortcuts - CSMPrefs::Shortcut* primaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-primary", this); + CSMPrefs::Shortcut* primaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-primary", "scene-speed-modifier", + CSMPrefs::Shortcut::SM_Detach, this); connect(primaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(primaryEdit(bool))); + connect(primaryEditShortcut, SIGNAL(secondary(bool)), this, SLOT(speedMode(bool))); CSMPrefs::Shortcut* secondaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-secondary", this); connect(secondaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(secondaryEdit(bool))); @@ -602,7 +605,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event) double factor = mDragFactor; - if (event->modifiers() & Qt::ShiftModifier) + if (mSpeedMode) factor *= mDragShiftFactor; EditMode& editMode = dynamic_cast (*mEditMode->getCurrent()); @@ -656,7 +659,7 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event) { double factor = mDragWheelFactor; - if (event->modifiers() & Qt::ShiftModifier) + if (mSpeedMode) factor *= mDragShiftFactor; EditMode& editMode = dynamic_cast (*mEditMode->getCurrent()); @@ -706,6 +709,11 @@ void CSVRender::WorldspaceWidget::secondarySelect(bool activate) handleInteraction(InteractionType_SecondarySelect, activate); } +void CSVRender::WorldspaceWidget::speedMode(bool activate) +{ + mSpeedMode = activate; +} + void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate) { if (activate) diff --git a/apps/opencs/view/render/worldspacewidget.hpp b/apps/opencs/view/render/worldspacewidget.hpp index f3c31f896..b30d7de8a 100644 --- a/apps/opencs/view/render/worldspacewidget.hpp +++ b/apps/opencs/view/render/worldspacewidget.hpp @@ -59,6 +59,7 @@ namespace CSVRender bool mDragging; int mDragX; int mDragY; + bool mSpeedMode; double mDragFactor; double mDragWheelFactor; double mDragShiftFactor; @@ -208,6 +209,8 @@ namespace CSVRender EditMode *getEditMode(); + bool getSpeedMode(); + private: void dragEnterEvent(QDragEnterEvent *event); @@ -269,6 +272,8 @@ namespace CSVRender void secondarySelect(bool activate); + void speedMode(bool activate); + protected slots: void elementSelectionChanged();