PDA

View Full Version : Removing Legend



cnbp173
20th December 2008, 01:22
Is there a way to remove or hide a Legend once it has been added to a QwtPlot?

I looked at the documentation, but couldn't find anything that did the trick. setHidden(bool) and setVisible(bool) also don't work for this...

Am I being a little slow and missing something simple?

Cheers

Uwe
20th December 2008, 10:41
plot->insertLegend(NULL). Guess "delete plot->legend()" will also work, but I havn't checked this.

Uwe

cnbp173
23rd January 2009, 00:08
Hi again Uwe,

I can't seem to get either of these options to work. Both create a crash in the program.

As soon as I issue the plot->insertLegend(NULL) it crashes, it does compile though

Any thoughts?

Uwe
23rd January 2009, 07:33
Start the debugger and check where it crashes ( something everyone should do before reporting ).

QwtPlot::insertLegend deletes the legend, that was previously inserted. When you also delete it in your application it might be the reason for the crash.

Uwe

cnbp173
23rd January 2009, 21:52
Hi Uwe,

Yep, I was running it in debugger and it was crashing. Turns out that the debugger was corrupted and not debugging properly. Fixed now, as is the Legend hiding.

Thanks.