Results 1 to 2 of 2

Thread: Changing the brush in QwtPlotLegendItem

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Changing the brush in QwtPlotLegendItem

    Hello!

    In one of my QwtPlots I have a couple of QwtPlotCurves with different styles (one is a normal line while the other is a dot line). In the same plot I have a QwtPlotLegendItem that serves as legends for these curves.

    Now as far as I can see, the line style doesn't appear in the legend: both legends show a normal filled rectangle with the colors of the respective curves.

    How can I customize the legend's rectangles appearence? I tried to customize all "draw" methods from QwtPlotLegendItem saying something like
    Qt Code:
    1. painter->setBrush(Qt::Dense3Pattern);
    To copy to clipboard, switch view to plain text mode 
    , but nothing happens :T


    Thanks,

    Momergil
    May the Lord be with you. Always.

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

    Default Re: Changing the brush in QwtPlotLegendItem

    There are a couple of options how a curve is represented on the legend ( see QwtPlotCurve::LegendAttributes ). If none of them matches what you need you have to overload QwtPlotCurve::legendIcon().

    Uwe

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

    Momergil (16th July 2014)

Similar Threads

  1. A suggestion about QwtPlotLegendItem
    By Nicho in forum Qwt
    Replies: 4
    Last Post: 7th April 2015, 12:06
  2. QwtPlotLegendItem with bar chart
    By Momergil in forum Qwt
    Replies: 0
    Last Post: 18th June 2014, 20:07
  3. Replies: 2
    Last Post: 13th September 2013, 12:47
  4. QwtPlotLegendItem and QwtLegendItem
    By jesse_mark in forum Qwt
    Replies: 3
    Last Post: 14th November 2012, 07:10
  5. something like colordialog, but with brush
    By Noxxik in forum Qt Programming
    Replies: 2
    Last Post: 22nd February 2009, 20:22

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.