Results 1 to 2 of 2

Thread: QwtLegendItem should show only checked entrys of QwtLegend (or visible PlotItems)

  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default QwtLegendItem should show only checked entrys of QwtLegend (or visible PlotItems)

    Hello,

    With the QwtLegend i manage the visibility of curves, markers etc. that are attached to to plot.
    I can't use the attribute QwtPlotItem::Legend, because if i set it to false it disapears from QwtLegend.

    The QwtPlotLegendItem inside of plot should show ONLY the visible items of the plot. How can i do this?

    Stefan
    Last edited by HappyCoder; 20th July 2015 at 09:00.

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

    Default Re: QwtLegendItem should show only checked entrys of QwtLegend (or visible PlotItems)

    With the QwtLegend i manage the visibility of curves, markers etc. that are attached to to plot.
    I can't use the attribute QwtPlotItem::Legend, because if i set it to false it disapears from QwtLegend.
    Yes of course: setting QwtPlotItem::Legend to false has the meaning of not being relevant for the legend.

    The QwtPlotLegendItem inside of plot should show ONLY the visible items of the plot. How can i do this?
    Overload QwtPlotLegendItem::updateLegend(), something like this:

    Qt Code:
    1. virtual void YourLegendItem::updateLegend( const QwtPlotItem *plotItem,
    2. const QList<QwtLegendData> &data )
    3. {
    4. if ( !plotItem->isVisible() )
    5. QwtPlotLegendItem::updateLegend( plotItem, QList<QwtLegendData>() );
    6. else
    7. QwtPlotLegendItem::updateLegend( plotItem, data );
    8. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QwtLegend position ?
    By hassinoss in forum Qwt
    Replies: 0
    Last Post: 4th February 2014, 17:30
  2. Replies: 2
    Last Post: 17th May 2011, 13:47
  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

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.