PDA

View Full Version : Questions for "Friedberg" sample



TorAn
1st May 2011, 01:15
I am studying this sample to understand qwt library class structure and I am using "Friedberg" sample as a starting point.

Question #1: Ticks

I understand MajorTicks as ones for which the label is drawn. I did not find the way to provide labels for MinorTicks and MediumTicks.
Is that correct?

Please let me know if it is possible to provide labels for Minor/Medium types of ticks.
The only method I found was protected member
const QwtText& QwtScaleDraw::tickLabel (const QFont & font, double value )const;

Overriding it in YearScaleDraw did not produce the label for the minor or medium ticks.


Question #2:
I change YearScaleDraw() constructor to assign values 4, 8, 24 for Minor, Medium and Major ticks respectively.

When FriedBerg sample starts it is show like this:
6333

Then I do zoom and, after zooming, it looks like this:
6332

Then I zoom back (right-mouse click) and it goes back to the original view as shown below, except that the X-scale is drawn differently compared to the first screenshot.
6334

Why is that?

Uwe
1st May 2011, 07:04
I did not find the way to provide labels for MinorTicks and MediumTicks.
Because there is none.


Question #2:
Something on my TODO list is to add the functionality to display labels in the middle between 2 major ticks. This is a typical use case for date time intervals.

The friedberg example shows a hack, that sets the length of the major ticks to 0 and enlarges the medium ticks to fake being major ticks. But this works for scales only, where the ticks are set manually from the application - in case of zooming in/out the ticks are calculated from the scale engine.

So the friedberg example is probably not the best code to learn about scales in Qwt.

Uwe