Results 1 to 3 of 3

Thread: QTWebPage and how to get the size of an image url for rendering

  1. #1
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default QTWebPage and how to get the size of an image url for rendering

    i am trying to render a web page into a file

    according to the documentation... you need to set the viewport size with the page.MainFrame() size...

    my problem is that if the url is an image document such as a simple jpg or png there is no such thing and page.MainFrame()->contentsSize() is (0,0)!

    Qt Code:
    1. page.setViewportSize(page.mainFrame()->contentsSize());
    2.  
    3. QImage image(page.viewportSize(), QImage::Format_ARGB32);
    4. QPainter painter(&image);
    To copy to clipboard, switch view to plain text mode 


    so the question is... if i have an url to a picture that is displayed by the renderer without any mainframe around, how can i collect the pixel size of this image document? The QTWebView displays the pixel size in the title so there should be a way to get this info


    Thank you for your help

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QTWebPage and how to get the size of an image url for rendering

    The size is probably in the header.

    If not, you need to download the complete image (or partial depending on the format)

  3. #3
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default Re: QTWebPage and how to get the size of an image url for rendering

    hello thank you, well what do you mean header? if you mean the picture header, well i have no problem figuring out the size of the picture if i download it. But i want to avoid that and just collect the size of this image document in the same manner than the QTWebView does

Similar Threads

  1. Replies: 8
    Last Post: 7th November 2012, 19:20
  2. Speeding up Image Rendering
    By reno77 in forum Newbie
    Replies: 2
    Last Post: 15th June 2010, 09:58
  3. Rendering an image within QwtPlot
    By ttvo in forum Qwt
    Replies: 4
    Last Post: 10th July 2009, 07:03
  4. Image Size Not Right
    By QbelcorT in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 7th April 2009, 09:11
  5. [QT4] QtextBrowser and image size (win)
    By sebgui in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 21:01

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
  •  
Qt is a trademark of The Qt Company.