Results 1 to 3 of 3

Thread: Increase legend icon size?

  1. #1
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Increase legend icon size?

    Hello,

    I'm using Qwt 6 (svn). I'd like to increase the size of the lines and symbols in the legend. I know that the symbol size there depends on the symbol size of a curve, but I just need to have the legend items drawn on larger rectangles, without increasing symbol sizes on the curves. I also need to change the sizes of NoSymbol-style items (where only the lines are drawn).

    The reason why I want this is that the current resulting images are not that good. I tried calling QwtPlotCurve::drawLegendIdentifier() with my own painter and 16x16 rectangle, and the results are way better. So I'd like to use a rectangle of the same size when drawing the legend items.

    Thanks in advance!

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

    Default Re: Increase legend icon size?

    You have to do something like this:

    Qt Code:
    1. void YourCurve::updateLegend( QwtLegend *legend ) const
    2. {
    3. QwtPlotCurve::updateLegend(legend);
    4. QwtLegendItem *lgdItem =
    5. dynamic_cast<QwtLegendItem*>(legend->find( this ));
    6. if ( lgdItem )
    7. lgdItem->setIdentifierSize( ... );
    8. }
    To copy to clipboard, switch view to plain text mode 

    I know this is not very comfortable ( worse than in Qwt 5.x ), but it needed to be changed for the new type of plot items, that also need to be displayed on the legend and I didn't want to lose too much time on this less important topic.

    Hope I will have something better in future Qwt versions,

    Uwe

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

    torrentss (1st September 2010)

  4. #3
    Join Date
    Jul 2009
    Posts
    12
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Increase legend icon size?

    Thanks a lot!

    I had to insert an extra call to QwtPlotItem::updateLegend(legend); at the end of YourCurve::updateLegend(), otherwise it wouldn't use the specified size for symbol-style legend items (lines were ok).

Similar Threads

  1. Font size increase in QtableWidget
    By sosanjay in forum Qt Programming
    Replies: 1
    Last Post: 19th November 2009, 15:51
  2. Replies: 3
    Last Post: 4th September 2009, 13:49
  3. How to increase font size in arm target
    By soumya in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 2nd September 2009, 06:58
  4. Increase the size of radio buttons
    By arunvv in forum Qt Programming
    Replies: 7
    Last Post: 24th January 2009, 01:09
  5. How to increase size of QGraphicsView Dynamically
    By Kingofhearts_sri in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2009, 09:54

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.