Skip to content
Permalink
Browse files

[3d] fix camera controller using wrong shift/ctrl status (fixes #20131)

We used Qt3DInput::QLogicalDevice with its axes and actions for camera
controller, but over time this got quite impractical, moreover we started
to have problems with shift/ctrl actions getting stuck in wrong state
in case they were pressed or released while 3D canvas was not focused
(which is in fact relatively common when using other widgets in the GUI)

This commit switches over to using just QMouseHandler and QKeyboardHandler
for handling key and mouse events and this not only makes the code easier
to read, but also the issues with shift/ctrl go away (because we do not
keep their status anymore, we just check whether they are active inside
event handlers).

The speed of change with mouse wheel and keys should be similar or a bit
less than what it was before.
  • Loading branch information
wonder-sk committed Nov 5, 2018
1 parent 1e16680 commit fbde0c8752740358fdb9bf9c232f72badfa1e87b
Showing with 246 additions and 270 deletions.
  1. +4 −0 src/3d/qgs3dmapscene.cpp
  2. +215 −231 src/3d/qgscameracontroller.cpp
  3. +26 −39 src/3d/qgscameracontroller.h
  4. +1 −0 src/app/3d/qgs3dmapcanvas.cpp
@@ -17,7 +17,11 @@

#include <Qt3DRender/QCamera>
#include <Qt3DRender/QMesh>
#include <Qt3DRender/QObjectPicker>
#include <Qt3DRender/QPickEvent>
#include <Qt3DRender/QPickingSettings>
#include <Qt3DRender/QPickTriangleEvent>
#include <Qt3DRender/QPointLight>
#include <Qt3DRender/QRenderSettings>
#include <Qt3DRender/QSceneLoader>
#include <Qt3DExtras/QForwardRenderer>

0 comments on commit fbde0c8

Please sign in to comment.
You can’t perform that action at this time.