title: Use Qt.MidButton and Qt.MidButton+Qt.ControlModifier in PyQt to rotate and translate/pan
body: <p>I am working on a simple 3D viewer using PyQt and its bindings for OpenGL. I would like to implement the following user actions (like for example in solidworks):</p>
  
  <ol>
  <li>pan/translate: with combination <code>ctrl</code>+<code>middle mouse button (pressed)</code></li>
  <li>rotate: <code>middle mouse button (pressed)</code></li>
  </ol>
  
  <p>and moving mouse. The code is:</p>
  
  <pre><code>def mousePressEvent(self, event):
      self.last_pos = event.posF()
  
  def mouseMoveEvent(self, event):
      dxy = event.posF() - self.last_pos
      dx = dxy.x() / self.width()
      dy = dxy.y() / self.height()
      #    rotate - 
      if event.buttons() &amp; Qt.MidButton:
          self.camera.rotate(dx, dy)
      #    translate/pan
      elif (event.buttons() &amp; Qt.MidButton) and (event.modifiers() &amp; Qt.ControlModifier):
          self.camera.pan(dx, dy)
      #    zoom
      self.last_pos = event.posF()
  </code></pre>
  
  <p>The problem I have is that when I press <code>ctrl</code> and then <code>middle mouse button</code> both (<code>self.camera.rotate(dx, dy)</code> and <code>self.camera.pan(dx, dy)</code>) functions are executed, but I would like just to translate the object(s). I would like to ask you is there a way how can the code be modified that translate and rotate will work with the desires key combinations. Right now I do not have any ideas.</p>