// Rotate about the object being viewed. void QGLGraphicsNavigationItemPrivate::rotate(qreal deltax, qreal deltay) { QGLCamera *camera = viewportItem->camera(); QRectF rect = viewportItem->rect(); int rotation = camera->screenRotation(); if (rotation == 90 || rotation == 270) { qSwap(deltax, deltay); } if (rotation == 90 || rotation == 180) { deltax = -deltax; } if (rotation == 180 || rotation == 270) { deltay = -deltay; } qreal anglex = deltax * 90.0f / rect.width(); qreal angley = deltay * 90.0f / rect.height(); QQuaternion q = camera->pan(-anglex); q *= camera->tilt(-angley); camera->rotateCenter(q); }