Results 1 to 2 of 2

Thread: Legend item with SVN trunk

  1. #1
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Legend item with SVN trunk

    Hello all!

    I am using Qwt from SVN trunk and am subclassing QwtPlotIntervalCurve. I only override the drawSeries and drawLines functions. Everything works except for the legend annotation. I would like a box that is colored the same as the line to appear. To fix that, I changed my constructor to add a symbol like follows:

    Qt Code:
    1. QwtIntervalSymbol *symbol = new QwtIntervalSymbol (QwtIntervalSymbol::Box);
    2. symbol->setBrush (QBrush (pen ().color ()));
    3. setSymbol (symbol);
    To copy to clipboard, switch view to plain text mode 

    This shows a box in the legend, but the box is black instead of the color of the line. This makes sense since the color is probably set after the constructor, but I'm not sure what to override to get the color like I'd like it.

    Is this the best way of doing this? What else should I override to get the color to be correct?

    Thanks for the help!
    Joey

  2. #2
    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: Legend item with SVN trunk

    Qt Code:
    1. virtual YourIntervalCurve::legendIcon( int, const QSizeF &size ) const
    2. {
    3. return defaultIcon( QBrush( pen().color() ), size );
    4. }
    To copy to clipboard, switch view to plain text mode 

    HTH,
    Uwe

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

    bigjoeystud (7th August 2012)

Similar Threads

  1. connect 1 legend item and 2 curve
    By ruzik in forum Qwt
    Replies: 1
    Last Post: 13th September 2011, 11:21
  2. Moving from Qwt 5.2 to 6.0 (trunk)
    By bigjoeystud in forum Qwt
    Replies: 18
    Last Post: 21st May 2010, 19:17
  3. qgl_use_font error during compilation of QT git trunk
    By manuels in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2010, 14:05
  4. Replies: 1
    Last Post: 20th February 2010, 12:42
  5. Replies: 2
    Last Post: 15th February 2010, 15:07

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.