Hide QwtLegend after inserting it???
Hi there...
I am trying to hide the legend in my plot AFTER the insertion of it.
I tried the hide() or setVisible() methods but they don't work with the legend!
Is it somehow possible? Is there a method that helps on that?
Using Qwt 6.0.1!!!
Thanks in advance...
Re: Hide QwtLegend after inserting it???
Code:
plot->insertLegend( NULL );
HTH,
Uwe
Re: Hide QwtLegend after inserting it???
Unfortunately it doesn't help Uwe...
Program can't even start.
Is there any possibility that this kind of functionality will get implemented in the future???
Re: Hide QwtLegend after inserting it???
It is implemented - whatever the reason of your crash is, you are the only one who can fix it.
Uwe
Re: Hide QwtLegend after inserting it???
Correction
It helps:
Code:
plot->insertLegend( NULL );
I probably didn't compile the project clean.
Thanks for the help...
Re: Hide QwtLegend after inserting it???
But what is a reason to not support show()/hide()? QwtAbstractLegend inherits QWidget, where show()/hide() are public methods. Ignoring show()/hide() breaks expected behavior. I am assuming this is due to QwtPlotLayout, which is not a QLayout.
Qwt looks designed very well with high level of customization/flexibility. And there is so-called "naked" interface, where a component provides direct access to its subcomponents, rather then expose only subcomponents properties (and so have full cotrol over side effects). Being "naked", a component must fully observe its subcomponents (via signals, eventFilter(), weak pointers, etc.).
So, one would expect
Code:
legend->setParent(NULL)
acts the same as
Code:
plot->insertLegend( NULL );
Is it OK, or breaks the code?
Note: In the first case QwtPlot must observe its legend (e.g. via handling ChildRemoved events).
Does Qwt have such observation everywhere in its code?
Thanks, Alex