Results 1 to 2 of 2

Thread: QWT legend customization

  1. #1
    Join Date
    May 2011
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWT legend customization

    First of all I would like to say hello to everybody (this is my first post ) and thanks to all people who made QWT available.

    I need to display a pair of pressure/impulse ( 2 curves ) for a number of points.
    Pressure and impulse curves are recognized by line type and have the same color (which depends on the point number).

    Plotting curves works fine.
    But standard legend requires too much unnecessary information information about curves - each curve label needs point number and color and line type.

    It would be much better to split information by category:
    ... Pressure
    __ Impulse
    [colored rectangle] point # 1
    [colored rectangle] point # 2


    Above requires:
    a) adding "dummy" curves which would not have any associated data ( no problem )
    b) having only 1 label per pair of the curves visible - this is much more difficult to achieve

    Problem with b) is that I could not find a way to skip plotting of the curve related data (marker/label) on the legend.
    The best I could achieve is to set curve legend attribute to QwtPlotCurve::LegendShowSymbol without providing a valid symbol.
    ( I was surprised that LegendNoAttribute does not have such meaning )

    Problem with such approach is that even if curve has no label text and displays nothing, it still present in the legend.

    While it might be OK when LegendItemMode is set to ReadOnlyItem,
    it is inappropriate for ClickableItem or CheckableItem.

    Any idea how desired effect can be achieved?

    Thanks in advance,
    Alex


    P.S. I am using qwt-6.0.0


    Added after 34 minutes:


    I found solution - QwtPlotCurve is QwtPlotItem subclass, so following removes curve legend =:
    QwtPlotItem::setItemAttribute( QwtPlotItem::Legend, false);

    Regards,
    Alex
    Last edited by alexmal; 20th May 2011 at 01:23.

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

    missoni (30th April 2012)

  3. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWT legend customization

    Markers and curves are plot items and for each item you can configure if it is supposed to appear on the legend or not.
    Qt Code:
    1. QwtPlotItem::setItemAttribute( QwtPlotItem::Legend, true/false);
    To copy to clipboard, switch view to plain text mode 
    ...
    just saw u got it.. srry should have read till end of post...
    Last edited by pkj; 20th May 2011 at 08:31.

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

    missoni (30th April 2012)

Similar Threads

  1. QTabWidget customization
    By asafzakay in forum Qt Programming
    Replies: 16
    Last Post: 26th November 2017, 12:01
  2. Customization of Qt Demo
    By nivditha in forum Newbie
    Replies: 7
    Last Post: 26th October 2010, 23:58
  3. QfileDialog customization
    By vjsharma_30 in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2010, 07:02
  4. QSqlTableModel column customization
    By kishore7771 in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2009, 10:07
  5. Window customization
    By Kostanev in forum Qt Programming
    Replies: 11
    Last Post: 14th August 2008, 19:04

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.