Skip to content
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.

(cherry picked from commit fbde0c8)
  • Loading branch information
wonder-sk committed Nov 22, 2018
1 parent ff35f9c commit 7c4708e0baf702d00dd3b78b340b6e5b5c0783f1
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 7c4708e

Please sign in to comment.