Is it possible to change the place where round scale is drawn. I'd like to move it further to the edge of dial. Also the needle has to be extended to the edges.
Here's an example.
ecutalk_v1.3.5_beta3_diesel_new.png
Is it possible to change the place where round scale is drawn. I'd like to move it further to the edge of dial. Also the needle has to be extended to the edges.
Here's an example.
ecutalk_v1.3.5_beta3_diesel_new.png
Last edited by phenoboy; 20th October 2013 at 15:11.
Thanks!
I did this:
QRect QwtGauge::scaleInnerRect() const {
return boundingRect();
}
and got this:
This is almost what I want. I still would like to draw scale and labels inside the circle. So almost like mirroring current drawing. Any help on this ? I found out that I probably need to override QwtRoundScaleDraw::drawTick and drawLabel. Am I on the right path ?
No QwtRoundScaleDraw always draws on the outer side - having the same on the inner side is on my TODO list for many years, but there was never enough interest to work on this feature.
I don't recommend your implementation of scaleInnerRect as it simply returns something wrong to have some side effect. F.e your ticks are cut off at the top edge now.
Instead I would implement a layout that organizes your dials, so that they overlap.
Uwe
Thanks for the comments. At least I'm interested - I think drawing ticks inside is more natural way but that's just me.
I looked at QwtRouncScaleDraw:: drawTick and drawLabel. I think I understand how they're drawn. Just to make sure is there anything else I need to modify to get ticks and labels drawn inside ?
Bt. the design of whole QwtDial and separate scaledraw class is fantastic. I wouldn't want to creat my own dial class just because of these ticks..
Of course it is, but the code for the scales is a couple of years older ( written for QwtKnob ) than QwtDial and I took what was available at that time.I think drawing ticks inside is more natural way but that's just me.
The difficult part is the layout code to avoid, that tick labels overlap ( sizeHint ... ) - usually a dial has more than only 1-2 labels like in your example. Note that QwtRoundScaleDraw is also used in the qwtpolar package.Just to make sure is there anything else I need to modify to get ticks and labels drawn inside ?
If you have something useful please upload a patch to: http://sourceforge.net/p/qwt/patches/?source=navbar
Uwe
I had a few minutes to look at this. It is not perfect. But starting to look quite allright for my purposes. For ticks code I just changed radius to radius - len( tick length from argument). Labels are harder. In drawLabel I'm just estimating radius (radius = radius - ticklen(MajorTick)*3. Sorry, Uwe I'm abusing your beautiful code It's not that easy to calculate correct radius. Font size should be taken into account too..
Where is this white arc drawn that follows ticks? It might look better if I could remove it ?
Bookmarks