Configurable mouse shortcuts.

This commit is contained in:
leo 2016-04-23 00:17:33 +00:00
parent 9c8a602a09
commit 5b0bf780cc
11 changed files with 206 additions and 45 deletions

View file

@ -305,6 +305,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
gMainWindow = new lcMainWindow(); gMainWindow = new lcMainWindow();
lcLoadDefaultKeyboardShortcuts(); lcLoadDefaultKeyboardShortcuts();
lcLoadDefaultMouseShortcuts();
if (!LoadPiecesLibrary(LibPath, LibraryInstallPath, LDrawPath)) if (!LoadPiecesLibrary(LibPath, LibraryInstallPath, LDrawPath))
{ {

View file

@ -30,9 +30,7 @@ struct lcInputState
{ {
int x; int x;
int y; int y;
bool Control; Qt::KeyboardModifiers Modifiers;
bool Shift;
bool Alt;
}; };
class lcGLWidget class lcGLWidget
@ -44,9 +42,7 @@ public:
mWidget = NULL; mWidget = NULL;
mInputState.x = 0; mInputState.x = 0;
mInputState.y = 0; mInputState.y = 0;
mInputState.Control = false; mInputState.Modifiers = Qt::NoModifier;
mInputState.Shift = false;
mInputState.Alt = false;
mContext = new lcContext(); mContext = new lcContext();
mDeleteContext = true; mDeleteContext = true;
} }

View file

@ -3434,6 +3434,9 @@ void lcModel::EndMouseTool(lcTool Tool, bool Accept)
case LC_TOOL_ZOOM_REGION: case LC_TOOL_ZOOM_REGION:
break; break;
case LC_NUM_TOOLS:
break;
} }
} }

View file

@ -94,7 +94,8 @@ enum lcTool
LC_TOOL_PAN, LC_TOOL_PAN,
LC_TOOL_ROTATE_VIEW, LC_TOOL_ROTATE_VIEW,
LC_TOOL_ROLL, LC_TOOL_ROLL,
LC_TOOL_ZOOM_REGION LC_TOOL_ZOOM_REGION,
LC_NUM_TOOLS
}; };
struct lcModelHistoryEntry struct lcModelHistoryEntry

View file

@ -63,7 +63,8 @@ lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES
lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH
lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY
lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_SHORTCUTS lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_KEYBOARD_SHORTCUTS
lcProfileEntry("Settings", "MouseShortcuts"), // LC_PROFILE_MOUSE_SHORTCUTS
lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES
lcProfileEntry("Settings", "RecentFile1", ""), // LC_PROFILE_RECENT_FILE1 lcProfileEntry("Settings", "RecentFile1", ""), // LC_PROFILE_RECENT_FILE1
lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2 lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2

View file

@ -19,7 +19,8 @@ enum LC_PROFILE_KEY
LC_PROFILE_CHECK_UPDATES, LC_PROFILE_CHECK_UPDATES,
LC_PROFILE_PROJECTS_PATH, LC_PROFILE_PROJECTS_PATH,
LC_PROFILE_PARTS_LIBRARY, LC_PROFILE_PARTS_LIBRARY,
LC_PROFILE_SHORTCUTS, LC_PROFILE_KEYBOARD_SHORTCUTS,
LC_PROFILE_MOUSE_SHORTCUTS,
LC_PROFILE_CATEGORIES, LC_PROFILE_CATEGORIES,
LC_PROFILE_RECENT_FILE1, LC_PROFILE_RECENT_FILE1,
LC_PROFILE_RECENT_FILE2, LC_PROFILE_RECENT_FILE2,

View file

@ -1,12 +1,14 @@
#include "lc_global.h" #include "lc_global.h"
#include "lc_shortcuts.h" #include "lc_shortcuts.h"
#include "lc_profile.h" #include "lc_profile.h"
#include "system.h"
lcKeyboardShortcuts gKeyboardShortcuts; lcKeyboardShortcuts gKeyboardShortcuts;
lcMouseShortcuts gMouseShortcuts;
void lcLoadDefaultKeyboardShortcuts() void lcLoadDefaultKeyboardShortcuts()
{ {
QByteArray Buffer = lcGetProfileBuffer(LC_PROFILE_SHORTCUTS); QByteArray Buffer = lcGetProfileBuffer(LC_PROFILE_KEYBOARD_SHORTCUTS);
QTextStream Stream(Buffer, QIODevice::ReadOnly); QTextStream Stream(Buffer, QIODevice::ReadOnly);
if (Buffer.isEmpty() || !gKeyboardShortcuts.Load(Stream)) if (Buffer.isEmpty() || !gKeyboardShortcuts.Load(Stream))
@ -20,14 +22,23 @@ void lcSaveDefaultKeyboardShortcuts()
gKeyboardShortcuts.Save(Stream); gKeyboardShortcuts.Save(Stream);
lcSetProfileBuffer(LC_PROFILE_SHORTCUTS, Buffer); lcSetProfileBuffer(LC_PROFILE_KEYBOARD_SHORTCUTS, Buffer);
} }
void lcResetDefaultKeyboardShortcuts() void lcResetDefaultKeyboardShortcuts()
{ {
gKeyboardShortcuts.Reset(); gKeyboardShortcuts.Reset();
lcRemoveProfileKey(LC_PROFILE_SHORTCUTS); lcRemoveProfileKey(LC_PROFILE_KEYBOARD_SHORTCUTS);
}
void lcLoadDefaultMouseShortcuts()
{
QByteArray Buffer = lcGetProfileBuffer(LC_PROFILE_MOUSE_SHORTCUTS);
QTextStream Stream(Buffer, QIODevice::ReadOnly);
if (Buffer.isEmpty() || !gMouseShortcuts.Load(Stream))
gMouseShortcuts.Reset();
} }
void lcKeyboardShortcuts::Reset() void lcKeyboardShortcuts::Reset()
@ -102,3 +113,95 @@ bool lcKeyboardShortcuts::Load(QTextStream& Stream)
return true; return true;
} }
void lcMouseShortcuts::Reset()
{
memset(mShortcuts, 0, sizeof(mShortcuts));
mShortcuts[LC_TOOL_ROTATE_VIEW].Modifiers = Qt::AltModifier;
mShortcuts[LC_TOOL_ROTATE_VIEW].Button = Qt::LeftButton;
mShortcuts[LC_TOOL_PAN].Modifiers = Qt::AltModifier;
mShortcuts[LC_TOOL_PAN].Button = Qt::MiddleButton;
mShortcuts[LC_TOOL_ZOOM].Modifiers = Qt::AltModifier;
mShortcuts[LC_TOOL_ZOOM].Button = Qt::RightButton;
}
QString gToolNames[LC_NUM_TOOLS] =
{
"AddPiece", // LC_TOOL_INSERT
"AddPointLight", // LC_TOOL_LIGHT
"AddSpotLight", // LC_TOOL_SPOTLIGHT
"AddCamera", // LC_TOOL_CAMERA
"Select", // LC_TOOL_SELECT
"Move", // LC_TOOL_MOVE
"Rotate", // LC_TOOL_ROTATE
"Delete", // LC_TOOL_ERASER
"Paint", // LC_TOOL_PAINT
"CameraZoom", // LC_TOOL_ZOOM
"CameraPan", // LC_TOOL_PAN
"CameraOrbit", // LC_TOOL_ROTATE_VIEW
"CameraRoll", // LC_TOOL_ROLL
"CameraZoomRegion" // LC_TOOL_ZOOM_REGION
};
LC_CASSERT(sizeof(gToolNames)/sizeof(gToolNames[0]) == LC_NUM_TOOLS);
bool lcMouseShortcuts::Save(QTextStream& Stream)
{
for (int ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
{
int ButtonIndex = 0;
for (int Button = mShortcuts[ToolIdx].Button; Button; Button >>= 1)
ButtonIndex++;
if (!ButtonIndex)
continue;
Stream << gToolNames[ToolIdx] << QLatin1String("=") << QKeySequence(mShortcuts[ToolIdx].Modifiers | (Qt::Key_0 + ButtonIndex)).toString() << QLatin1String("\n");
}
Stream.flush();
return true;
}
bool lcMouseShortcuts::Load(QTextStream& Stream)
{
memset(mShortcuts, 0, sizeof(mShortcuts));
for (QString Line = Stream.readLine(); !Line.isNull(); Line = Stream.readLine())
{
int Equals = Line.indexOf('=');
if (Equals == -1)
continue;
QString Key = Line.left(Equals);
int ToolIdx;
for (ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
if (gToolNames[ToolIdx] == Key)
break;
if (ToolIdx == LC_NUM_TOOLS)
continue;
QKeySequence KeySequence(Line.mid(Equals + 1));
if (KeySequence.isEmpty())
continue;
int Shortcut = KeySequence[0];
mShortcuts[ToolIdx].Modifiers = (Qt::KeyboardModifier)(Shortcut & Qt::KeyboardModifierMask);
mShortcuts[ToolIdx].Button = (Qt::MouseButton)(1 << (Shortcut & ~Qt::KeyboardModifierMask));
}
return true;
}
lcTool lcMouseShortcuts::GetTool(Qt::MouseButton Button, Qt::KeyboardModifiers Modifiers) const
{
for (int ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
if (mShortcuts[ToolIdx].Button == Button && mShortcuts[ToolIdx].Modifiers == Modifiers)
return (lcTool)ToolIdx;
return LC_NUM_TOOLS;
}

View file

@ -2,6 +2,7 @@
#define _LC_SHORTCUTS_H_ #define _LC_SHORTCUTS_H_
#include "lc_commands.h" #include "lc_commands.h"
#include "lc_model.h"
class lcKeyboardShortcuts class lcKeyboardShortcuts
{ {
@ -21,4 +22,26 @@ void lcLoadDefaultKeyboardShortcuts();
void lcSaveDefaultKeyboardShortcuts(); void lcSaveDefaultKeyboardShortcuts();
void lcResetDefaultKeyboardShortcuts(); void lcResetDefaultKeyboardShortcuts();
class lcMouseShortcuts
{
public:
void Reset();
bool Save(QTextStream& Stream);
bool Load(QTextStream& Stream);
lcTool GetTool(Qt::MouseButton Button, Qt::KeyboardModifiers Modifiers) const;
struct
{
Qt::KeyboardModifiers Modifiers;
Qt::MouseButton Button;
}
mShortcuts[LC_NUM_TOOLS];
};
extern lcMouseShortcuts gMouseShortcuts;
void lcLoadDefaultMouseShortcuts();
void lcSaveDefaultMouseShortcuts();
void lcResetDefaultMouseShortcuts();
#endif // _LC_SHORTCUTS_H_ #endif // _LC_SHORTCUTS_H_

View file

@ -294,7 +294,7 @@ lcMatrix44 View::GetProjectionMatrix() const
LC_CURSOR_TYPE View::GetCursor() const LC_CURSOR_TYPE View::GetCursor() const
{ {
if (mTrackTool == LC_TRACKTOOL_SELECT && mInputState.Control) if (mTrackTool == LC_TRACKTOOL_SELECT && (mInputState.Modifiers & Qt::ControlModifier))
return LC_CURSOR_SELECT_GROUP; return LC_CURSOR_SELECT_GROUP;
const LC_CURSOR_TYPE CursorFromTrackTool[] = const LC_CURSOR_TYPE CursorFromTrackTool[] =
@ -1625,6 +1625,34 @@ lcTool View::GetCurrentTool() const
return ToolFromTrackTool[mTrackTool]; return ToolFromTrackTool[mTrackTool];
} }
lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
{
lcTool OverrideTool = gMouseShortcuts.GetTool(Qt::LeftButton, mInputState.Modifiers);
if (OverrideTool == LC_NUM_TOOLS)
return LC_TRACKTOOL_NONE;
lcTrackTool TrackToolFromTool[LC_NUM_TOOLS] =
{
LC_TRACKTOOL_INSERT, // LC_TOOL_INSERT
LC_TRACKTOOL_POINTLIGHT, // LC_TOOL_LIGHT
LC_TRACKTOOL_SPOTLIGHT, // LC_TOOL_SPOTLIGHT
LC_TRACKTOOL_CAMERA, // LC_TOOL_CAMERA
LC_TRACKTOOL_SELECT, // LC_TOOL_SELECT
LC_TRACKTOOL_MOVE_XYZ, // LC_TOOL_MOVE
LC_TRACKTOOL_ROTATE_XYZ, // LC_TOOL_ROTATE
LC_TRACKTOOL_ERASER, // LC_TOOL_ERASER
LC_TRACKTOOL_PAINT, // LC_TOOL_PAINT
LC_TRACKTOOL_ZOOM, // LC_TOOL_ZOOM
LC_TRACKTOOL_PAN, // LC_TOOL_PAN
LC_TRACKTOOL_ORBIT_XY, // LC_TOOL_ROTATE_VIEW
LC_TRACKTOOL_ROLL, // LC_TOOL_ROLL
LC_TRACKTOOL_ZOOM_REGION // LC_TOOL_ZOOM_REGION
};
return TrackToolFromTool[OverrideTool];
}
float View::GetOverlayScale() const float View::GetOverlayScale() const
{ {
lcVector3 OverlayCenter; lcVector3 OverlayCenter;
@ -2052,6 +2080,9 @@ void View::UpdateTrackTool()
case LC_TOOL_ZOOM_REGION: case LC_TOOL_ZOOM_REGION:
NewTrackTool = LC_TRACKTOOL_ZOOM_REGION; NewTrackTool = LC_TRACKTOOL_ZOOM_REGION;
break; break;
case LC_NUM_TOOLS:
break;
} }
switch (mDragState) switch (mDragState)
@ -2137,6 +2168,9 @@ void View::StartTracking(lcTrackButton TrackButton)
case LC_TOOL_ZOOM_REGION: case LC_TOOL_ZOOM_REGION:
break; break;
case LC_NUM_TOOLS:
break;
} }
OnUpdateCursor(); OnUpdateCursor();
@ -2165,7 +2199,7 @@ void View::StopTracking(bool Accept)
{ {
lcArray<lcObject*> Objects = FindObjectsInBox(mMouseDownX, mMouseDownY, mInputState.x, mInputState.y); lcArray<lcObject*> Objects = FindObjectsInBox(mMouseDownX, mMouseDownY, mInputState.x, mInputState.y);
if (mInputState.Control) if (mInputState.Modifiers & Qt::ControlModifier)
mModel->AddToSelection(Objects); mModel->AddToSelection(Objects);
else else
mModel->SetSelectionAndFocus(Objects, NULL, 0); mModel->SetSelectionAndFocus(Objects, NULL, 0);
@ -2218,6 +2252,9 @@ void View::StopTracking(bool Accept)
} }
} }
break; break;
case LC_NUM_TOOLS:
break;
} }
mTrackButton = LC_TRACKBUTTON_NONE; mTrackButton = LC_TRACKBUTTON_NONE;
@ -2243,9 +2280,11 @@ void View::OnLeftButtonDown()
gMainWindow->SetActiveView(this); gMainWindow->SetActiveView(this);
if (mInputState.Alt) lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::LeftButton);
if (OverrideTool != LC_TRACKTOOL_NONE)
{ {
mTrackTool = LC_TRACKTOOL_ORBIT_XY; mTrackTool = OverrideTool;
OnUpdateCursor(); OnUpdateCursor();
} }
else if (mTrackTool == LC_TRACKTOOL_MOVE_XYZ) else if (mTrackTool == LC_TRACKTOOL_MOVE_XYZ)
@ -2267,7 +2306,7 @@ void View::OnLeftButtonDown()
mModel->InsertPieceToolClicked(GetPieceInsertPosition()); mModel->InsertPieceToolClicked(GetPieceInsertPosition());
if (!mInputState.Control) if ((mInputState.Modifiers & Qt::ControlModifier) == 0)
gMainWindow->SetTool(LC_TOOL_SELECT); gMainWindow->SetTool(LC_TOOL_SELECT);
UpdateTrackTool(); UpdateTrackTool();
@ -2278,7 +2317,7 @@ void View::OnLeftButtonDown()
{ {
mModel->PointLightToolClicked(UnprojectPoint(lcVector3((float)mInputState.x, (float)mInputState.y, 0.9f))); mModel->PointLightToolClicked(UnprojectPoint(lcVector3((float)mInputState.x, (float)mInputState.y, 0.9f)));
if (!mInputState.Control) if ((mInputState.Modifiers & Qt::ControlModifier) == 0)
gMainWindow->SetTool(LC_TOOL_SELECT); gMainWindow->SetTool(LC_TOOL_SELECT);
UpdateTrackTool(); UpdateTrackTool();
@ -2294,7 +2333,7 @@ void View::OnLeftButtonDown()
{ {
lcObjectSection ObjectSection = FindObjectUnderPointer(false); lcObjectSection ObjectSection = FindObjectUnderPointer(false);
if (mInputState.Control) if (mInputState.Modifiers & Qt::ControlModifier)
mModel->FocusOrDeselectObject(ObjectSection); mModel->FocusOrDeselectObject(ObjectSection);
else else
mModel->ClearSelectionAndSetFocus(ObjectSection); mModel->ClearSelectionAndSetFocus(ObjectSection);
@ -2360,7 +2399,7 @@ void View::OnLeftButtonDoubleClick()
lcObjectSection ObjectSection = FindObjectUnderPointer(false); lcObjectSection ObjectSection = FindObjectUnderPointer(false);
if (mInputState.Control) if (mInputState.Modifiers & Qt::ControlModifier)
mModel->FocusOrDeselectObject(ObjectSection); mModel->FocusOrDeselectObject(ObjectSection);
else else
mModel->ClearSelectionAndSetFocus(ObjectSection); mModel->ClearSelectionAndSetFocus(ObjectSection);
@ -2376,9 +2415,11 @@ void View::OnMiddleButtonDown()
gMainWindow->SetActiveView(this); gMainWindow->SetActiveView(this);
if (mInputState.Alt) lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::MiddleButton);
if (OverrideTool != LC_TRACKTOOL_NONE)
{ {
mTrackTool = LC_TRACKTOOL_PAN; mTrackTool = OverrideTool;
OnUpdateCursor(); OnUpdateCursor();
StartTracking(LC_TRACKBUTTON_MIDDLE); StartTracking(LC_TRACKBUTTON_MIDDLE);
} }
@ -2399,9 +2440,11 @@ void View::OnRightButtonDown()
gMainWindow->SetActiveView(this); gMainWindow->SetActiveView(this);
if (mInputState.Alt) lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::RightButton);
if (OverrideTool != LC_TRACKTOOL_NONE)
{ {
mTrackTool = LC_TRACKTOOL_ZOOM; mTrackTool = OverrideTool;
OnUpdateCursor(); OnUpdateCursor();
} }
else if (mTrackTool == LC_TRACKTOOL_MOVE_XYZ) else if (mTrackTool == LC_TRACKTOOL_MOVE_XYZ)
@ -2785,5 +2828,5 @@ void View::OnMouseMove()
void View::OnMouseWheel(float Direction) void View::OnMouseWheel(float Direction)
{ {
mModel->Zoom(mCamera, (int)((mInputState.Control ? 100 : 10) * Direction)); mModel->Zoom(mCamera, (int)(((mInputState.Modifiers & Qt::ControlModifier) ? 100 : 10) * Direction));
} }

View file

@ -134,6 +134,7 @@ protected:
void UpdateTrackTool(); void UpdateTrackTool();
lcTool GetCurrentTool() const; lcTool GetCurrentTool() const;
lcTrackTool GetOverrideTrackTool(Qt::MouseButton Button) const;
float GetOverlayScale() const; float GetOverlayScale() const;
void StartTracking(lcTrackButton TrackButton); void StartTracking(lcTrackButton TrackButton);
void StopTracking(bool Accept); void StopTracking(bool Accept);

View file

@ -164,7 +164,7 @@ void lcQGLWidget::keyPressEvent(QKeyEvent *event)
{ {
if (isView && event->key() == Qt::Key_Control) if (isView && event->key() == Qt::Key_Control)
{ {
widget->mInputState.Control = true; widget->mInputState.Modifiers = event->modifiers();
widget->OnUpdateCursor(); widget->OnUpdateCursor();
} }
@ -175,7 +175,7 @@ void lcQGLWidget::keyReleaseEvent(QKeyEvent *event)
{ {
if (isView && event->key() == Qt::Key_Control) if (isView && event->key() == Qt::Key_Control)
{ {
widget->mInputState.Control = false; widget->mInputState.Modifiers = event->modifiers();
widget->OnUpdateCursor(); widget->OnUpdateCursor();
} }
@ -188,9 +188,7 @@ void lcQGLWidget::mousePressEvent(QMouseEvent *event)
widget->mInputState.x = event->x() * scale; widget->mInputState.x = event->x() * scale;
widget->mInputState.y = widget->mHeight - event->y() * scale - 1; widget->mInputState.y = widget->mHeight - event->y() * scale - 1;
widget->mInputState.Control = (event->modifiers() & Qt::ControlModifier) != 0; widget->mInputState.Modifiers = event->modifiers();
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
switch (event->button()) switch (event->button())
{ {
@ -227,9 +225,7 @@ void lcQGLWidget::mouseReleaseEvent(QMouseEvent *event)
widget->mInputState.x = event->x() * scale; widget->mInputState.x = event->x() * scale;
widget->mInputState.y = widget->mHeight - event->y() * scale - 1; widget->mInputState.y = widget->mHeight - event->y() * scale - 1;
widget->mInputState.Control = (event->modifiers() & Qt::ControlModifier) != 0; widget->mInputState.Modifiers = event->modifiers();
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
switch (event->button()) switch (event->button())
{ {
@ -266,9 +262,7 @@ void lcQGLWidget::mouseDoubleClickEvent(QMouseEvent *event)
widget->mInputState.x = event->x() * scale; widget->mInputState.x = event->x() * scale;
widget->mInputState.y = widget->mHeight - event->y() * scale - 1; widget->mInputState.y = widget->mHeight - event->y() * scale - 1;
widget->mInputState.Control = (event->modifiers() & Qt::ControlModifier) != 0; widget->mInputState.Modifiers = event->modifiers();
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
switch (event->button()) switch (event->button())
{ {
@ -286,9 +280,7 @@ void lcQGLWidget::mouseMoveEvent(QMouseEvent *event)
widget->mInputState.x = event->x() * scale; widget->mInputState.x = event->x() * scale;
widget->mInputState.y = widget->mHeight - event->y() * scale - 1; widget->mInputState.y = widget->mHeight - event->y() * scale - 1;
widget->mInputState.Control = (event->modifiers() & Qt::ControlModifier) != 0; widget->mInputState.Modifiers = event->modifiers();
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
widget->OnMouseMove(); widget->OnMouseMove();
} }
@ -305,9 +297,7 @@ void lcQGLWidget::wheelEvent(QWheelEvent *event)
widget->mInputState.x = event->x() * scale; widget->mInputState.x = event->x() * scale;
widget->mInputState.y = widget->mHeight - event->y() * scale - 1; widget->mInputState.y = widget->mHeight - event->y() * scale - 1;
widget->mInputState.Control = (event->modifiers() & Qt::ControlModifier) != 0; widget->mInputState.Modifiers = event->modifiers();
widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0;
widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
mWheelAccumulator += event->angleDelta().y() / 8; mWheelAccumulator += event->angleDelta().y() / 8;
@ -362,9 +352,7 @@ void lcQGLWidget::dragMoveEvent(QDragMoveEvent *event)
widget->mInputState.x = event->pos().x() * scale; widget->mInputState.x = event->pos().x() * scale;
widget->mInputState.y = widget->mHeight - event->pos().y() * scale - 1; widget->mInputState.y = widget->mHeight - event->pos().y() * scale - 1;
widget->mInputState.Control = (event->keyboardModifiers() & Qt::ControlModifier) != 0; widget->mInputState.Modifiers = event->keyboardModifiers();
widget->mInputState.Shift = (event->keyboardModifiers() & Qt::ShiftModifier) != 0;
widget->mInputState.Alt = (event->keyboardModifiers() & Qt::AltModifier) != 0;
widget->OnMouseMove(); widget->OnMouseMove();