Results 1 to 4 of 4

Thread: QWT 6.1 Customizing Legend Labels and Icon Position

  1. #1
    Join Date
    Nov 2014
    Posts
    5
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

    Default QWT 6.1 Customizing Legend Labels and Icon Position

    Hello all,

    This is one of my first posts, so feel free to correct any breaches in style/protocol

    I am using QWT 6.1 and I have a graph with two axis' and two curves. The blue curve goes with the axis on the left, the red curve with the axis on the right.

    The objectives:

    Spread out the axis entries.
    I know I can do this, but I am having a lot of trouble finding out how to get to the Plot Legend Labels for my curves. (I now that I could add to their margins if I could get to them)

    Change the order of label and legend icon
    Generally, the legend icon comes before the legend label--I'd like to reverse that so that the icon is to the right of the label that goes with the yRight axis making it absolutely clear to which axis it belongs.

    As these are kind of general things, I haven't attached my code, should that be desirable, let me know.

    Thank you to everyone!

  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: QWT 6.1 Customizing Legend Labels and Icon Position

    Spread out the axis entries.
    Not sure, what is meant here.

    Change the order of label and legend icon
    This is not supported by QwtLegendLabel, but you could overload:


    virtual QWidget *QwtLegend::createWidget( const QwtLegendData & ) const;
    virtual void QwtLegend::updateWidget( QWidget *widget, const QwtLegendData &data );
    virtual void QwtLegend::renderItem( QPainter *,
    const QWidget *, const QRectF &, bool fillBackground ) const;

    Uwe

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

    BagpipesJohnson (14th November 2014)

  4. #3
    Join Date
    Nov 2014
    Posts
    5
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

    Default Re: QWT 6.1 Customizing Legend Labels and Icon Position

    Uwe,

    Thank you for the response--

    I was hoping to avoid overloading, but if that's what it is, so be it.

    As for spreading out, I mis-spoke--I want to spread out the legend entries, not the axis entries. In the attached screen shot, the blue and the red lines correspond to different y-axis'. I want to spread them out so that the blue legend entry is to the left, near it's axis with the red entry to the right, near its own yRight axis. I was pretty sure that I could get to these if I could get at the plot legend labels--Can you tell me how to get to those?

    Thank you!

    first_sensor_orient_graph.jpg

  5. #4
    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: QWT 6.1 Customizing Legend Labels and Icon Position

    Then you might consider to derive from QwtAbstractLegend, implementing something simple based on a QHBoxLayout of 4 widgets ( 2 icons, 2 labels ) and a stretch in the center.

    Uwe

Similar Threads

  1. view position of mouse position in GraphicsScene
    By Raghaw in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2012, 04:46
  2. Increase legend icon size?
    By torrentss in forum Qwt
    Replies: 2
    Last Post: 1st September 2010, 12:26
  3. Replies: 4
    Last Post: 3rd May 2010, 11:41
  4. Icon position
    By Stobie in forum Qt Programming
    Replies: 2
    Last Post: 7th December 2009, 04:49
  5. Text/icon position of a tabWidget
    By b_ginner in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2009, 09:07

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.