Results 1 to 4 of 4

Thread: QwtPlot Mouse Event

  1. #1
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QwtPlot Mouse Event

    Hai
    In my Project, I have a Main Widget in that QWT Plot Widget and some other widgets [QList ..].
    I can get the MouseMoveEvent of my MainWidget but not able to get QWTPlot MouseMoveEvent.

    suggestion please

    Qt Code:
    1. void MainPlot::mousePressEvent(QMouseEvent *event) // this is my MainWidget called MainPlot
    2. {
    3. ------
    4. ------
    5. }
    To copy to clipboard, switch view to plain text mode 

    and
    my QWTPLOT Mouse Event is
    Qt Code:
    1. void MainPlot::ui->uPlot->mouseMoveEvent(QMouseEvent *) // Uplot is my QWTPLOT widget
    2. {
    3. // some code
    4. ------------------
    5. -------------------
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2009
    Location
    Tennessee, US
    Posts
    41
    Thanks
    3
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot Mouse Event

    Amos
    Qt Programmer Extraordinaire

    Current Work:
    Ripxx Sports Measurement Device - www.ripxx.com
    (Featured in MYTHBUSTERS on 2010-05-19 in S08E08)

  3. #3
    Join Date
    Jul 2009
    Posts
    49
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot Mouse Event

    Hai

    Thanks for ur reply

    I am trying like this using event filter

    Qt Code:
    1. legend->InstallEventFilter(this);
    2.  
    3.  
    4. bool MainPlot::eventFilter(QObject *Object, QEvent *Event)
    5. {
    6. if(Object==ui->uPlot->legend())
    7. {
    8. if(Event->type()==QEvent::MouseMove)
    9. {
    10. QMouseEvent *a=static_cast<QMouseEvent*>(Event);
    11. MainPlot::ui->uPlot->legend()->setFrameStyle(QFrame::Box);
    12. MainPlot::ui->uPlot->legend()->setGeometry(a->x(),a->y(),ui->uPlot->legend()->width(),ui->uPlot->legend()->height());
    13. }
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

    The legend widget is moving but not properly..

    any suggestion pl.



    by
    Suree
    INdia

  4. #4
    Join Date
    Mar 2009
    Location
    Tennessee, US
    Posts
    41
    Thanks
    3
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot Mouse Event

    Quote Originally Posted by umulingu View Post
    The legend widget is moving but not properly..
    First, you need to tell your legend to be an external legend so that it hovers over the canvas.
    Qt Code:
    1. uplot->insertLegend(_legend, QwtPlot::ExternalLegend);
    To copy to clipboard, switch view to plain text mode 
    Second, use move instead of setGeometry ...
    Qt Code:
    1. uPlot->legend()->move(a->pos());
    To copy to clipboard, switch view to plain text mode 

    That should make it move right.
    Amos
    Qt Programmer Extraordinaire

    Current Work:
    Ripxx Sports Measurement Device - www.ripxx.com
    (Featured in MYTHBUSTERS on 2010-05-19 in S08E08)

  5. The following user says thank you to amoswood for this useful post:

    umulingu (29th June 2010)

Similar Threads

  1. how to detect mouse click on qwtPlot?
    By rambo83 in forum Qwt
    Replies: 7
    Last Post: 18th December 2013, 05:04
  2. Replies: 3
    Last Post: 12th May 2010, 13:11
  3. Mouse Event
    By cemshit in forum Newbie
    Replies: 1
    Last Post: 27th January 2010, 20:50
  4. How to keep the mouse event?
    By oscar721 in forum Qt Programming
    Replies: 1
    Last Post: 27th October 2009, 09:48
  5. Mouse over event
    By merry in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2007, 11:13

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
  •  
Qt is a trademark of The Qt Company.