Results 1 to 3 of 3

Thread: How do I add a + next to Qt::ArrowCursor

  1. #1
    Join Date
    Apr 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How do I add a + next to Qt::ArrowCursor

    I've been adding a few features that I need to QGraphicsView among others sketchup 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
    Last edited by sirGustav; 1st April 2009 at 22:45.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How do I add a + next to Qt::ArrowCursor

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How do I add a + next to Qt::ArrowCursor

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.