Results 1 to 2 of 2

Thread: Two separate QwtLegend objects in one QwtPlot

  1. #1

    Default Two separate QwtLegend objects in one QwtPlot

    Hello all,

    I'm new to programming with Qwt in C++. I have a plot with some curves and markers in it. Currently, I have one QwtLegend for the curves and markers, however, I want to have two separate QwtLegends, one for the curves and one for the markers. Is this possible? If yes, how can I do that?

    What I would also be satisfied with would be to have one QwtLegend with curves and markers in separate rows. I have found the function QwtLegend::setMaxColumns(uint columns), but unfortunately, the legend shows more than three items in one row. My code for that looks as follows:

    QwtLegend *legend = new QwtLegend();
    legend->setFrameStyle(QFrame::Box);
    legend->setMaxColumns(3);
    plot->insertLegend(legend, QwtPlot::TopLegend, 1.0);

    What am I doing wrong?

    Thank you very much in advance.
    Last edited by javiator; 8th December 2014 at 09:38.

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

    Default Re: Two separate QwtLegend objects in one QwtPlot

    In theory you could have several legends, but the plot layout is only capable of having one. So you would have to write the layout code to tie plot and additional legends yourself.
    QwtPlot::insertLegend(() changes the max columns attribute, so you would have to set it to 3 after the statement.

    Uwe

Similar Threads

  1. Aligning QwtLegend to QwtPlot
    By bisasatan in forum Qwt
    Replies: 3
    Last Post: 15th May 2013, 12:51
  2. QwtLegend orientation on QwtPlot
    By bday1223 in forum Qwt
    Replies: 1
    Last Post: 27th September 2011, 06:26
  3. Replies: 10
    Last Post: 18th September 2008, 15:14
  4. Replies: 1
    Last Post: 9th February 2008, 12:46
  5. Replies: 7
    Last Post: 18th July 2006, 21:33

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.