Results 1 to 1 of 1

Thread: Fitting QWebView to content

  1. #1
    Join Date
    Sep 2010
    Location
    Zamość, Poland
    Posts
    13
    Thanks
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Symbian S60

    Default Fitting QWebView to content

    Hello.

    When I writing my weather "gadget" I met some trouble with size of QWebView. My program uses QWebView as main Widget and I want to fit window to content size. I set html and body size, but when I determining width and height of window to size of body, I can see scrollbars. I reading size with jQuery. Only way to hide them is set "overflow: hidden" in CSS section for body. Body and html sizes are 230x188px. How to fix it?

    This is piece of code, where I set window and viewport size:
    Qt Code:
    1. this->page()->mainFrame()->evaluateJavaScript(jQSource);
    2. int width = this->page()->mainFrame()->evaluateJavaScript("$('html').width()").toInt();
    3. int height = this->page()->mainFrame()->evaluateJavaScript("$('html').height()").toInt();
    4. this->page()->setViewportSize(QSize::QSize(width, height));
    5. resize(width, height);
    To copy to clipboard, switch view to plain text mode 

    I'm tried with this, but detected size was 800x600px:

    Qt Code:
    1. this->page()->setViewportSize(this->page()->mainFrame()->contentsSize());
    To copy to clipboard, switch view to plain text mode 
    Thanks in advance.
    Last edited by Sölve; 7th September 2010 at 01:29. Reason: spelling corrections

Similar Threads

  1. Replies: 8
    Last Post: 3rd September 2013, 10:51
  2. set content(&file)
    By rk0747 in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2010, 09:31
  3. Moving QGraphicsItems and Fitting QGraphicsView
    By aladagemre in forum Qt Programming
    Replies: 0
    Last Post: 30th January 2010, 19:21
  4. How to get text field content in QWebView
    By richardander in forum Qt Programming
    Replies: 1
    Last Post: 2nd June 2009, 08:04
  5. QT4 - get content of a QAbstractItemModel
    By incapacitant in forum Newbie
    Replies: 4
    Last Post: 18th March 2006, 07:23

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.