PDA

View Full Version : QScrollArea - content strech,scale



kemp
16th January 2007, 08:00
Hi!

I am writing an print preview. I subclassed the QScrollArea and overrided the paintevent,
so i draw direct on it. Now I want to make "Fit Page" and "Fit Width" like in Adobe Acrobat Readers print preview. Currently I am having trouble with "Fit Page" because the content
wont strech with the window. I tried different kinds of wariations with layers but no effect.
I also tried to scale it with the ratio of width() and hight(), but i don't get the wished result.
Is someone having similar experiences?
I would be very thankful if someone could help me out of this misery.

Thanks.

e8johan
16th January 2007, 08:34
This article shows how to use a scroll view and always center a document: http://qt4.digitalfanatics.org/articles/zoomer.html . Perhaps it can help you get started.

Bitto
18th January 2007, 18:15
You can also use QGraphicsView, which already provides fitInView() for fit-to-page and fit-to-width, and fitting with ignored aspect ratio.

At least you won't have to write all that code...