Results 1 to 3 of 3

Thread: QwtPlotCurve setZ() removes old LegendLabel and adds a new one

  1. #1
    Join Date
    Sep 2015
    Posts
    3
    Thanks
    1

    Default QwtPlotCurve setZ() removes old LegendLabel and adds a new one

    Hello,

    so i have an application where a lot of curves can be on the plot at one time. I have written a method that lets me select one of these curves by clicking on it.
    To indicate clearly that this line has been selected i set the color of it to red and increase the width.
    Now i also want to get this curve to be drawn on top of all the other curves.
    To do this i use the setZ() method of QwtPlotCurve and it works just fine.
    But my problem is that everytime i use setZ() on a Curve the associated LegendLabel gets removed and a new one gets attached to my Legend and is now deselected and not in the position it was at the beginning.
    I need the LegendLabel to stay selected (which is no problem) and also be in the same position.

    Is there any way i can avoid that a new LegendLabel gets added or find out the position of the old LegendLabel and put the new LegendLabel in the same position?
    The Version im using is 6.1.0

    Solove.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,253
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotCurve setZ() removes old LegendLabel and adds a new one

    The connection between plot widget and legend is depending on the QwtPlot::legendDataChanged() signal. So you could try something like this:

    Qt Code:
    1. item->plot()->blockSignals( true );
    2. item->setZ( ... );
    3. item->plot()->blockSignals( false );
    To copy to clipboard, switch view to plain text mode 
    Uwe

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

    solove (30th September 2015)

  4. #3
    Join Date
    Sep 2015
    Posts
    3
    Thanks
    1

    Default Re: QwtPlotCurve setZ() removes old LegendLabel and adds a new one

    Thank you very much. Works exactly like i wanted.

    solove

Similar Threads

  1. Replies: 8
    Last Post: 9th February 2014, 13:37
  2. [QTabWidget] Removes all the pages and delete them
    By qt_developer in forum Newbie
    Replies: 4
    Last Post: 17th August 2013, 02:18
  3. Replies: 8
    Last Post: 18th October 2012, 08:23
  4. Replies: 1
    Last Post: 11th May 2012, 09:02
  5. Replies: 6
    Last Post: 20th October 2010, 16:17

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.