Results 1 to 7 of 7

Thread: changing appearance of the cursor in QwtPlotPicker?

  1. #1
    Join Date
    Oct 2011
    Location
    Zurich
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default changing appearance of the cursor in QwtPlotPicker?

    Is it possible to change the appearance of the mouse cursor inside QwtPlotPicker from the large cross symbol to something else?

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: changing appearance of the cursor in QwtPlotPicker?

    I don't think you can do it on the Picker, but you can on Canvas: QwtPlotCanvas::setCursor(Qt::ForbiddenCursor);
    You can even specify your own custom cursor if you want.
    http://doc.qt.nokia.com/stable/qcursor.html

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: changing appearance of the cursor in QwtPlotPicker?

    Quote Originally Posted by Spitfire View Post
    I don't think you can do it on the Picker, ...
    Of course you can. There are a some basic options how to display the rubberband and if none of them fits you can overload drawRubberband.

    Uwe

  4. #4
    Join Date
    Oct 2011
    Location
    Zurich
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: changing appearance of the cursor in QwtPlotPicker?

    Hi Spitfire & Uwe,

    Thanks for your replies.

    @Uwe, how does one go about overloading the drawRubberBand? I've so far defined a customized Picker function with the following (i.e. if I wanted to change the "+" cursor into a rectangle)? The following doesn't compile, btw . I get errors for

    error 1: invalid use of incomplete type ‘struct QPainter’
    error 2: forward declaration of ‘struct QPainter’


    Qt Code:
    1. class MyPicker: public QwtPlotPicker
    2. {
    3. public:
    4. MyPicker():QwtPlotPicker() {};
    5.  
    6. virtual void drawRubberBand(QPainter *p) const
    7. {
    8. QRect myNewCursor = QRect(0,0,10,10);
    9. p->drawRect(myNewCursor); // error 1 here
    10. }
    11. };
    12.  
    13. class MainWindow : public QMainWindow { // error 2 here
    14. etc.
    15. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: changing appearance of the cursor in QwtPlotPicker?

    add
    Qt Code:
    1. #include <QPainter>
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to Spitfire for this useful post:

    lazierbug (18th October 2011)

  7. #6
    Join Date
    Oct 2011
    Location
    Zurich
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: changing appearance of the cursor in QwtPlotPicker?

    Now it compiles! Thanks!

    But this doesn't replace the little white "+"-symbol? Is this really part of the rubber band?

  8. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: changing appearance of the cursor in QwtPlotPicker?

    No this is the cursor:

    Qt Code:
    1. plot()->canvas()->setCursor( ... );
    To copy to clipboard, switch view to plain text mode 
    See http://doc.trolltech.com/4.7/qwidget.html#cursor-prop

    Uwe

Similar Threads

  1. Replies: 3
    Last Post: 18th October 2011, 11:54
  2. Update of lable / changing the cursor
    By mw0001 in forum Newbie
    Replies: 3
    Last Post: 24th February 2010, 08:15
  3. Replies: 2
    Last Post: 2nd October 2009, 15:32
  4. Cursor not changing
    By bpetty in forum Newbie
    Replies: 4
    Last Post: 17th July 2007, 15:13
  5. ummm...cursor not changing...
    By nupul in forum Qt Programming
    Replies: 7
    Last Post: 4th May 2006, 16:57

Tags for this Thread

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.