Results 1 to 3 of 3

Thread: QScrollArea - content strech,scale

  1. #1
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QScrollArea - content strech,scale

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QScrollArea - content strech,scale

    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.

  3. The following user says thank you to e8johan for this useful post:

    kemp (16th January 2007)

  4. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QScrollArea - content strech,scale

    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...
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

Similar Threads

  1. Replies: 2
    Last Post: 8th October 2006, 20:14
  2. dynamic qscrollarea
    By hijinks in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2006, 16:48
  3. Replies: 7
    Last Post: 20th September 2006, 14:45
  4. is there any signal for QScrollArea?
    By rajesh in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2006, 07:12
  5. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.