Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Change cursor #1132
This pull request is related to GUI feature request 'Set mousecursor when rotating or dragging in viewport' #1039.
A cross cursor is provided as via QApplication::setOverrideCursor for translation and a rotate icon for rotation in the MouseMoveEvent
A public domain rotate icon is added. Tested on Windows 8.1 and Debian Jessie (I don't have access to OS X at the moment.)
The setOverrideCursor pushes the cursor state onto a stack and pops the state at release. Testing demonstrated edge cases where the user could go form rotate to translate (or vice versa) directly and push two changes onto the stack. This required counting the number of pushes and executing the appropriate number of pops in the MouseReleaseEvent.
A line in each of two QGLView.cc functions: void QGLView::mousePressEvent(QMouseEvent *event) (add) QApplication::setOverrideCursor(QCursor(Qt::CrossCursor)); and void QGLView::mouseReleaseEvent(QMouseEvent*) (add) QApplication::restoreOverrideCursor();
So I can find the place in QGLView.cc that responds to the shift-right and shift-middle zooms:
But I'm finding, on at least the computer I'm on, that I can initiate zoom with a touchpad gesture (which creates it's own special cursor) and with the middle button. I read above that the middle button should pan, not zoom, so that's a little weird (I checked my mouse config and middle is mapped to middle.)
I'm not sure if this behavior is different on different boxen (I'll try some other boxes at work tomorrow, but I'm pretty sure the one I'm on here at home is the only three button system I have.) I also don't have any actual mice, but I'm willing to guess that a mousewheel would also zoom.
Does the middle button pan for everyone else? Reading through the QMouse docs (http://qt-project.org/doc/qt-4.8/qmouseevent.html) it appears that the mousewheel is a different class, the QWheelEvent Class (http://qt-project.org/doc/qt-4.8/qwheelevent.html) and the touchpad is yet another, the QTouchEvent Class (http://qt-project.org/doc/qt-4.8/qtouchevent.html) so it appears feasible to add them. Hpwever, I'm not sure if doing so merits a larger discussion about their potential and use for possibly more than just displaying a zoom cursor. Or maybe that's a good start. I don't know.
So.... here are a couple options I'd like to get some feedback on:
Option 1 is very easy, option 2 is a better overall experience assuming all aspects are code-able without truly unnatural acts.
I have a 3 button (plus 2 on the side) wheel mouse also with wheel left/right scroll ability. W7/64 bit.
I'd suggest Option 1, then Option 2 as another issue with more discussion. But who am I...
@TDeagan I think the zoom cursor in MeshLab has potential: https://github.com/starseeker/meshlab/blob/master/src/meshlab/images/cursors/plain_zoom.png
(..but without the normal mouse cursor)