Results 1 to 6 of 6

Thread: Is it possible to get a legend ID using QwtLegend?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    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: Is it possible to get a legend ID using QwtLegend?

    Hey,

    The legend item list is sorted, but the key is not the text but the pointer to the widget:
    Qt Code:
    1. "Curve 5" QwtLegendItem(0x931ead0)
    2. "Curve 0" QwtLegendItem(0x931eb48)
    3. "Curve 4" QwtLegendItem(0x931ebe8)
    4. "Curve 1" QwtLegendItem(0x931ec10)
    5. "Curve 6" QwtLegendItem(0x931ecb0)
    6. "Curve 3" QwtLegendItem(0x931ef08)
    7. "Curve 2" QwtLegendItem(0x933ad50)
    8. "Curve 7" QwtLegendItem(0x933ae90)
    9. "Curve 8" QwtLegendItem(0x933af30)
    10. "Curve 9" QwtLegendItem(0x933afd0)
    To copy to clipboard, switch view to plain text mode 

    So answer to question 2 is: list doesn't change the order, it's just ordered by something else that you'd expect.

    I don't know where you got the 'ser_no', but I couldn't find it anywhere in qwt 6.0.1 source I have.

    To answer your original question:
    Create additional map of your curves in format: QMap< QwtPlotItem*, int >, where pointer is your curve, and int is its ID (may be index in other list you have or anything else that you find useful);
    this way in your setConfig() you can get ID of each curve from the pointer you're getting there.

    Now I have a question:
    Why do you need it for?
    There may be something wrong with your thinking here.

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

    cesroc (8th June 2012)

Similar Threads

  1. QwtLegend orientation on QwtPlot
    By bday1223 in forum Qwt
    Replies: 1
    Last Post: 27th September 2011, 06:26
  2. QwtPolarMarker and QwtLegend
    By lokida in forum Qwt
    Replies: 4
    Last Post: 29th March 2011, 09:00
  3. QwtLegend size
    By baray98 in forum Qwt
    Replies: 3
    Last Post: 11th May 2010, 09:55
  4. QwtLegend size
    By baray98 in forum Qwt
    Replies: 0
    Last Post: 10th May 2010, 05:26
  5. Set Title for QWTLegend...
    By umulingu in forum Qwt
    Replies: 3
    Last Post: 23rd March 2010, 09:28

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