← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3789: Add support for qglviewer>=2.5.0.

 

------------------------------------------------------------
revno: 3789
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-01-06 14:57:32 +0100
message:
  Add support for qglviewer>=2.5.0.
modified:
  gui/qt4/GLViewerMouse.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'gui/qt4/GLViewerMouse.cpp'
--- gui/qt4/GLViewerMouse.cpp	2013-10-16 05:48:14 +0000
+++ gui/qt4/GLViewerMouse.cpp	2014-01-06 13:57:32 +0000
@@ -36,20 +36,34 @@
 #endif
 
 void GLViewer::mouseMovesCamera(){
-	camera()->frame()->setWheelSensitivity(-1.0f);
-
-	setMouseBinding(Qt::SHIFT + Qt::LeftButton, SELECT);
-	//setMouseBinding(Qt::RightButton, NO_CLICK_ACTION);
-	setMouseBinding(Qt::SHIFT + Qt::LeftButton + Qt::RightButton, FRAME, ZOOM);
-	setMouseBinding(Qt::SHIFT + Qt::MidButton, FRAME, TRANSLATE);
-	setMouseBinding(Qt::SHIFT + Qt::RightButton, FRAME, ROTATE);
-	setWheelBinding(Qt::ShiftModifier , FRAME, ZOOM);
-
-	setMouseBinding(Qt::LeftButton + Qt::RightButton, CAMERA, ZOOM);
-	setMouseBinding(Qt::MidButton, CAMERA, ZOOM);
-	setMouseBinding(Qt::LeftButton, CAMERA, ROTATE);
-	setMouseBinding(Qt::RightButton, CAMERA, TRANSLATE);
-	setWheelBinding(Qt::NoModifier, CAMERA, ZOOM);
+  camera()->frame()->setWheelSensitivity(-1.0f);
+  
+  setWheelBinding(Qt::ShiftModifier , FRAME, ZOOM);
+  setWheelBinding(Qt::NoModifier, CAMERA, ZOOM);
+
+#if QGLVIEWER_VERSION>=0x020500
+  setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, SELECT);
+  
+  setMouseBinding(Qt::ShiftModifier, Qt::LeftButton | Qt::RightButton, FRAME, ZOOM);
+  setMouseBinding(Qt::ShiftModifier, Qt::MidButton, FRAME, TRANSLATE);
+  setMouseBinding(Qt::ShiftModifier, Qt::RightButton, FRAME, ROTATE);
+    
+  setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, ZOOM);
+  setMouseBinding(Qt::NoModifier, Qt::MidButton, CAMERA, ZOOM);
+  setMouseBinding(Qt::NoModifier, Qt::LeftButton, CAMERA, ROTATE);
+  setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, TRANSLATE);
+#else
+  setMouseBinding(Qt::SHIFT + Qt::LeftButton, SELECT);
+  
+  setMouseBinding(Qt::SHIFT + Qt::LeftButton + Qt::RightButton, FRAME, ZOOM);
+  setMouseBinding(Qt::SHIFT + Qt::MidButton, FRAME, TRANSLATE);
+  setMouseBinding(Qt::SHIFT + Qt::RightButton, FRAME, ROTATE);
+  
+  setMouseBinding(Qt::LeftButton + Qt::RightButton, CAMERA, ZOOM);
+  setMouseBinding(Qt::MidButton, CAMERA, ZOOM);
+  setMouseBinding(Qt::LeftButton, CAMERA, ROTATE);
+  setMouseBinding(Qt::RightButton, CAMERA, TRANSLATE);
+#endif
 };
 
 void GLViewer::mouseMovesManipulatedFrame(qglviewer::Constraint* c){