Use an image as QwtDialNeedle
I see Qwt comes with examples on QwtDial and QwtDialNeedle.
I wonder if it's possible to use a custom image as QwtDialNeedle.
I think it should be necessary to re-implement the virtual functions of QwtDialNeedle (draw, setPalette, drawNeedle, ...) and then it should work.
Can someone confirm this, please?
Is there a working example somewhere?
Thanks
Re: Use an image as QwtDialNeedle
Overloading the QwtDialNeedle::setPalette doesn't make much sense - you can't do much with it.
QwtDialNeedle::draw sets up a transformation matrix, according to the direction and then calls drawNeedle, what should be o.k for your situation.
So you only need to overload drawNeedle and maybe drawKnob - if you have such a thing.
Of course you only will have results without aliasing effects, when using a vector graphics format like SVG - in case your type of dial rotates the needle.
Uwe
Re: Use an image as QwtDialNeedle
Following your suggestion I've been able to get what I need (i.e. a dial with an image as a needle; the needle rotates; the image is a png).
Everything works fine when I build my application for Windows 7 x86 (Qt 4.8.4).
When I cross-compile to CE 6 (Qt 4.8.4) the needle is not drawn properly when the direction is 180° (i.e. 9 o'clock).
Sometimes it's not drawn at all, sometimes is partially drawn, ...
Could this be a matter of aliasing effect?
Re: Use an image as QwtDialNeedle
Quote:
Originally Posted by
vix
Could this be a matter of aliasing effect?
Don't think so,
Uwe
Re: Use an image as QwtDialNeedle
I implemeted a dirty workaround: when the direction is between 179.9 and 180.1, set the direction itself to 180.1.
The little displacement is not an issue for my application and so in this way everything is ok both on Win 7 and in CE 6.
Do you have any idea on what could be the reason for this behavior?
Re: Use an image as QwtDialNeedle
Maybe a division by zero - but without knowing your code this is pure speculation.
Uwe