Hello!

I would like to draw something like a timeline with ticks on it, showing timestamps. Simple said: a 1-dimenional diagram.

Now this timeline has some size, lets say 1000 pixels wide (but is resizable) and may show events within a few minutes or a couple of weeks.

Works fine with scaling the thing using QPainter::scale(this->width() / (double)minTime.secsTo(maxTime), 1) // minTime, maxTime ist of type QDateTime

So I can resize the widget, I can change the min and max time which is shown and I do not get grey hair by scaling myself at almost every line I hack in. Perfect!

Now I want to add ticks and label those ticks with the time corresponding to it's position.

The ticks themself are no problem, that works fine. But the font bothers me. That font gets scaled too, making it unreadable. If the timeline shows one week and has 1000 pixels of with, the actual scaling factor would be 0.00165 and any font would be unreadable since it would squeeze whole words into one single pixel.

Stretching the font is not an option, since the strtech factor is limited (4000 says the docu).
Scaling the font larger before drawing is not a satisfying option, since this means that I have to do my own scaling when drawing the vertical ticks.

So I end up with doing my font drawing before I use QPainter::scale() and calculation the position with my private scaling. Maybe I did not really understand viewport? Maybe I missed some flag which prevents the squeezing of the font?

I attach a screenshot of the relevant part of this prototype (yes, strings still overlap).
Bildschirmfoto2.jpg