Results 1 to 5 of 5

Thread: How to move the plot legend item around by mouse?

  1. #1
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default How to move the plot legend item around by mouse?

    Hi,
    I want to move the plot legend items on the plot by mouse events:
    To select a legend item by press event and then move it around.
    When the mouse button is released, the legend item will be displayed at the position of the mouse.
    I have coded sth. according to the example 'itemeditor'.
    But it doesn't work.
    I guess the reason is:
    I have reimplemented the QwtPlotLegendItem::draw().
    Just add a judgement about whether the item is visible.
    But the QwtPlotLegendItem::geometry() is not a virtual one.
    I can not calculate the new geometry of the item which is used by draw() function.

    IN conclusion,
    FOR the QwtPlotLegendItem,it can be aligned by 8 types .
    My question is how to display a legend item at any position.
    How could I do?

    Thanks .

    Nicho
    Last edited by Nicho; 22nd July 2013 at 16:05. Reason: updated contents

  2. #2
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to move the plot legend item around by mouse?

    Uwe, I need your help again .

    Nicho

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

    Default Re: How to move the plot legend item around by mouse?

    Quote Originally Posted by Nicho View Post
    But the QwtPlotLegendItem::geometry() is not a virtual one.
    It is - and overloading it is what you have to do.

    Uwe

  4. The following user says thank you to Uwe for this useful post:

    Nicho (23rd July 2013)

  5. #4
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to move the plot legend item around by mouse?

    Quote Originally Posted by Uwe View Post
    It is - and overloading it is what you have to do.

    Uwe
    Uwe,
    Thank you so much.
    I was working on QWT6.1 but not the latest one.
    Now I have downloaded the latest release.
    After compiling, it does work.
    So great.
    Thank you.

    Nicho

  6. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to move the plot legend item around by mouse?

    There is only one version of Qwt 6.1 so far - everything else have been release candidates or snapshots.

    Uwe

Similar Threads

  1. Move the Legend widget using MouseEvent
    By umulingu in forum Qwt
    Replies: 4
    Last Post: 16th June 2010, 14:33
  2. Replies: 5
    Last Post: 27th November 2009, 13:57
  3. Replies: 1
    Last Post: 24th February 2009, 18:35
  4. Remove Legend items, move legends
    By giusepped in forum Qwt
    Replies: 0
    Last Post: 11th February 2009, 02:35
  5. how to display full tree item name on mouse move ?
    By rajesh in forum Qt Programming
    Replies: 5
    Last Post: 15th November 2006, 08:41

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.