Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change cursor #1132

wants to merge 3 commits into
base: master
Choose a base branch

Change cursor #1132

wants to merge 3 commits into from


Copy link

@TDeagan TDeagan commented Jan 2, 2015

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.

TDeagan added 3 commits Dec 30, 2014
A line in each of two functions:

void QGLView::mousePressEvent(QMouseEvent *event)
(add)       QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));


void QGLView::mouseReleaseEvent(QMouseEvent*)
(add)       QApplication::restoreOverrideCursor();
Rotate icon is now a public domain file (images/rotate.png)
Copy link

kintel commented Jan 5, 2015

It works :)
@TDeagan Did you stumble across a zoom icon while at it?

Copy link
Contributor Author

TDeagan commented Jan 5, 2015

Should be easy enough to make white with black trim versions of the ones use on the toolbar (plus and minus in magnifying glass). I'll whip some up and figure out where the hooks are.

Copy link
Contributor Author

TDeagan commented Jan 6, 2015

So I can find the place in that responds to the shift-right and shift-middle zooms:

 // Right button pans in the xz plane
      // Middle button pans in the xy plane
      // Shift-right and Shift-middle zooms
      if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) {
        cam.viewer_distance += (GLdouble)dy;

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 ( it appears that the mousewheel is a different class, the QWheelEvent Class ( and the touchpad is yet another, the QTouchEvent Class ( 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 to just add a Zoom Cursor, e.g.
    zoom_cursor to the shift middle and shift right button events
  • Option 2 is to add in the QWheelEvent and QTouchEvent classes to the QGLView code and try to respond to all mouse/touchpad zoom events.

Option 1 is very easy, option 2 is a better overall experience assuming all aspects are code-able without truly unnatural acts.

Copy link

MichaelAtOz commented Jan 6, 2015

I have a 3 button (plus 2 on the side) wheel mouse also with wheel left/right scroll ability. W7/64 bit.
Left - rotates
Right - translates
Middle - Nothing
Vertical scroll - zoom in/out
Horizontal scroll - zoom in/out (would be good to do something else with this, Orthogonal/Persective maybe?)
Both side buttons - translate.

I'd suggest Option 1, then Option 2 as another issue with more discussion. But who am I...

@kintel kintel added this to the 2014 QX milestone Jan 14, 2015
Copy link

kintel commented Jan 20, 2015

@TDeagan I think the zoom cursor in MeshLab has potential:

(..but without the normal mouse cursor)

@kintel kintel modified the milestones: 2015.XX, 2014 QX Feb 3, 2015
@kintel kintel moved this from In Progress to Required in OpenSCAD Next Release Sep 3, 2017
@kintel kintel moved this from Required to TODO - Required in OpenSCAD Next Release Sep 3, 2017
@kintel kintel moved this from TODO - Required to Optional in OpenSCAD Next Release Oct 8, 2018
@t-paul t-paul added this to Fixes in The Future Nov 10, 2018
@t-paul t-paul removed this from Move to a later release in OpenSCAD Next Release Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants