Re: curve Symbol
Brought to you by:
rathmann
From: Hendrik V. <HVe...@gm...> - 2013-08-05 14:35:02
|
Hi Gianni, my 0.02$ worth: If I remember correctly, the idea was that a) QwtPlotCurve does not call any non-const functions (hence it gets a pointer to const QwtSymbol in setSymbol() -- oops, edit: just saw that in 6.1.0, the const was dropped apparently?) and b) it has no way of knowing if the symbol changed, just like in your case: you change your one property but the curve does not get noticed and hence cannot react (like trigger an auto-replot and such stuff). But since the curve only gets a pointer to const, it also can only give you a pointer to const back (again, after writing, I just saw that setSymbol() was changed in 6.1.0)... So, yes, I guess, as it is implemented now, you need some sort of a "clone" function. And I would guess that's the reason why the copy constructor is private: you are encouraged to subclass QwtSymbol, but in the case of a subclass, the copy constructor just won't suffice (assignment is still available, though, but that would need to be called explicitly -- probably, that's the intention: preventing you from "accidentally" calling the copy constructor) and you would really need some clone function, such that the following would work (MySymbol::clone : MySymbol *symbol = MySymbol::clone(curve->symbol()) ; symbol->doMyChanges(...) ; curve->setSymbol(symbol) ; Ok, this may be cumbersome if you only use the default implementation and don't actually have a custom symbol class. In that case, using the assignment operator is probably your best choice... Again, just my idea of what should be done; Uwe will certainly have the better answer ;) Best, Hendrik On Monday, August 05, 2013 15:16:51 Gianni Ambrosio wrote: > Dear Uwe, > I moved from Qwt 6.0.1 to Qwt 6.1.0 and I fonud some changes about plot > symbol. > Basically I need to change just one parameter of a plotcurve symbol but > can just get a "const" QwtSymbol* from a QwtPlotCurve. I could barely > const cast it, anyway, since setSymbol() implementation of QwtPlotCurve > would delete the previos symbol I think the only way to change just one > feature of an existing symbol is to create a new one and "manually" copy > style, brush, pen and size. In fact also the QwtSymbol copy constructor > is now private. > Maybe I'm worng or there's probably a reason, but it seems, in this > case, Qwt API is not so simple. > > Regards > Gianni > > > > > ---------------------------------------------------------------------------- > -- Get your SQL database under version control now! > Version control is standard for application code, but databases havent > caught up. So what steps can you take to put your SQL databases under > version control? Why should you start doing it? Read more to find out. > http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk > _______________________________________________ > qwt-interest mailing list > qwt...@li... > https://lists.sourceforge.net/lists/listinfo/qwt-interest |