Reply
Thread Tools
Posts: 82 | Thanked: 214 times | Joined on Jan 2010 @ Cape town
#1
I figured I'd post here before reporting a bug - seeing as how someone may have some more insight into this.

Running the following (be it from Python or qmlviewer directly) works great on both my desktop and my N900:

Code:
import Qt 4.7
import QtWebKit 1.0

Rectangle{
        WebView {
            id: webView
            url: "http://www.google.co.za"
            width: 800
            height: 480
            //html:  "<html><body>I LIKE PIE<br><br><br>PIEPIEPIE!</body></html>"
        }
    }
However - the following ONLY seems to work on my desktop:
Code:
import Qt 4.7
import QtWebKit 1.0

Rectangle{
        WebView {
            id: webView
            //url: "http://www.google.co.za"
            width: 800
            height: 480
            html:  "<html><body>I LIKE PIE<br><br><br>PIEPIEPIE!</body></html>"
        }
    }
and ditto for
Code:
import Qt 4.7
import QtWebKit 1.0

Rectangle{
        WebView {
            id: webView
            url: "file:///tmp/test.html"
            width: 800
            height: 480
            //html:  "<html><body>I LIKE PIE<br><br><br>PIEPIEPIE!</body></html>"
        }
    }
It seems as if the WebView on the N900 only works when its loading something from the internet?
 
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#2
Setting the HTML worked for me (in the QMLViewer), but I needed to insert a <font color='white'> tag:

Code:
import QtQuick 1.0
import QtWebKit 1.0

WebView {

    width: 800
    height: 480
    html : "<html><body><font color='white'>I like pie<br><br><br>piepiepie!</font></body></html>"
}


I think the problem is that you have not set the width and height properties of the rectangle, so it defaults to 0 * 0. You should set the rectangle to 800 * 480, and use anchors.fill: parent for the webView.
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2011-04-20 at 21:28.
 

The Following User Says Thank You to marxian For This Useful Post:
Posts: 82 | Thanked: 214 times | Joined on Jan 2010 @ Cape town
#3
Originally Posted by marxian View Post
Setting the HTML worked for me (in the QMLViewer), but I needed to insert a <font color='white'> tag:

Code:
import QtQuick 1.0
import QtWebKit 1.0

WebView {

    width: 800
    height: 480
    html : "<html><body><font color='white'>I like pie<br><br><br>piepiepie!</font></body></html>"
}
That seems so obvious - yet I would've never have gotten it... I guess because in QML most things defaulted to white, I figured the webview would've done the same! Haha, I should go rest for a bit...

Many thanks
 
Reply


 
Forum Jump


All times are GMT. The time now is 06:36.