View Full Version : How do I add a + next to Qt::ArrowCursor

1st April 2009, 23:38
I've been adding a few features that I need to QGraphicsView among others sketchup (http://www.youtube.com/watch?v=WfANG06Bieg) like selection that includes the ctrl/shift for selection modification. The selection part wasn't that hard, and I think I got it working without sacrificing that much.

Anyway, I cant figure out how to add that plus, minus or plus&minus without disturbing the current cursor image. Changing to my crappy ArrowCursor bitmap/pixmap with the extra images will probably look different that the default ArrowCursor, and I want to avoid that.

What I would like is a pixmap() function in QCursor that can grab the pixmap/bitmap from. The QCursor has such functions, but I'm guessing that these are mere getters from the constructor arguments.

Currently, the best idea that I can come up with is that I make my cursor radically different from the main ArrowCursor and keep it overridden within my view. Looking closely at the sketchup-video they have a black cursor in the viewport but a white in the menu..

Any ideas?

I've been using the latest version(Qt 4.5) with QtCreator on windows xp if that matters

2nd April 2009, 09:51
They are overriding the cursor as well. You could try fetching a handle of the cursor and getting the shape in a platform specific way although I'm not sure it is possible at all.

But I'd like to suggest a less drastic and more original solution - don't change your cursor but rather provide a visual notification about the mode in the viewport itself, for example by displaying an OSD-like textual information in the corner of the viewport. It would be a quite pleasant way of handling it and you could display some more complex information this way as well.

2nd April 2009, 22:20
The osd idea seemed like a fresh idea so I implemented it. Even though my implementation might be less than ideal it served its purposes. I felt that the osd would be in my way, even if I made it transparent. I considered putting that information like that in the statusbar some time ago, but I felt that it could easily be missed(same reasoning could be made with a osd that is too small).

I've actually renoticed that AutoCad uses a custom crosshair instead of a cursor, makes sense if you need to select stuff accurately per-pixel. Probably not fit for my application or my needs, but still it might be a valid technique for others.

Looks like I'm going for the black cursor after all :(