[Qt-qml] Trying hard to get WebView to work from a QML only program on N900 with Qt 4.7
Sacha Zyto
sacha at mit.edu
Wed Jul 21 22:38:20 CEST 2010
Hi Bruce,
About the org.webkit 1.0 vs QtWebkit 1.0 (and more generally code that
differs from what you run w/ qmlviewer and embed inside a C++ Qt app,
I've personnally found that the following trick helps:
In your qml code, add comments such as
import org.webkit 1.0 //_QML
//_CPP import QtWebKit 1.0
(assuming you want your code to run "as is" with qmmlviewer).
... and before incorportating into a C++ based project, add something
like the following to your makefile:
CURRENTDIRNAME = $(shell pwd | sed 's|.*/\([^/]*\)$$|\1|')
BUILDDIR = ../$(CURRENTDIRNAME)-build
embedded:
find $(BUILDDIR) -name '*.qml' | xargs sed -i -e 's|//_CPP||' -e
's|.*//_QML||'
in other words, if your app is called 'MyTestApp', and that you have a
copy of MyTestApp called MyTestApp-build (make can also create that copy
for you of course), then running 'make embedded' will make all the qml
files inside MyTestApp-build compatible with the qml that needs to be
run from a c++ app.
What kind of cross-hatched pattern do you get ? Could you pls. post a
picture somewhere. Just a guess (because I ran into a similar problem on
the desktop): if it's something that looks badly aliased, did you
compile Qt 4.7 with the proper font antialiasing options (-xrender
etc...) ? My configure options looks like:
./configure -release -opensource -shared -fast -no-qt3support
-declarative -fontconfig -nomake tools -nomake examples -nomake demos
-nomake docs -nomake translations -xrender -xrandr -xcursor -xfixes
-xinput -glib
(also add the -v option to see explicitly when configure chooses to
exclude support (such as xrender)).
Hope this helps.
Best,
Sacha
On 07/21/2010 03:58 PM, bruce.cichowlas at nokia.com wrote:
> I discovered that I needed two specific lines in my QML to run WebView on my N900, like this:
>
> import Qt 4.7
> import QtWebKit 1.0
>
> Item {
> Rectangle {
> height:30
> color:"red"
> width:parent.width
> anchors.top : parent.top
> id:red
> }
> WebView {
> anchors.top:red.bottom
> anchors.bottom:yellow.top
>
> url:"http://nokia.com"
> }
> Rectangle {
> id:yellow
> height:30
> color:"yellow"
> width:parent.width
> anchors.bottom : parent.bottom
> }
> }
>
> Thanks.
>
> This means that I can't run on my desktop PC without remembering to change back to
>
> import org.webkit 1.0
>
> but I can live with that.
>
> Though I can bring up WebView without crashing now, I am still unable to get a web page to load from a URL, though I've just begun trying to find the problem in the above. I am able to successfully use embedded HTML, as in :
>
> WebView {
> html:"\
> <body bgcolor=white>\
> <table border=1>\
> <tr><th><th>One<th>Two<th>Three\
> <tr><th>1<td>X<td>1<td>X\
> <tr><th>2<td>0<td>X<td>0\
> <tr><th>3<td>X<td>1<td>X\
> </table>"
> }
>
> When I load from a URL, I just get a cross-hatched pattern for the page unless it is a very short page, in which case I get a cross-hatched pattern at the top and whitespace underneath. I guess this indicates that it really is loading the page, but for some reason is not rendering correctly on the screen. I'll see if I can figure this out.
>
> Thanks for the help.
> Bruce
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-qml
>
More information about the Qt-qml
mailing list