Hmm.  It looks like it also works if I just use constants for the 
preferredWidth / preferredHeight:


import Qt 4.7

import QtWebKit 1.0

Flickable{

    width: 640; height:480

    contentWidth: webView.width

    contentHeight: webView.height

    WebView {

        id: webView

        preferredWidth: 640

        preferredHeight: 480

        url: 'http://qt.nokia.com'

    }

}

However, if I try to bind preferredWidth / preferredHeight to the parent 
properties, I get the checkerboard.


import Qt 4.7

import QtWebKit 1.0

Flickable{

    width: 640; height:480

    contentWidth: webView.width

    contentHeight: webView.height

    WebView {

        id: webView

        preferredWidth: parent.width

        preferredHeight: parent.height

        url: 'http://qt.nokia.com'

    }

}



On Nov 6, 2010, at 7:41 AM, ext 
andrew.christ...@nokia.com<mailto:andrew.christ...@nokia.com> wrote:

I ran into the same problem.  Oddly, I found that it can be solved with:

import Qt 4.7
import QtWebKit 2.0

Flickable{
    width: 240; height:400

    function updateContentSize(w,h) {
contentWidth = Math.max(width,w);
contentHeight = Math.max(height,h);
    }

    WebView {
        id: webView
        preferredWidth: parent.width
preferredHeight: parent.height
        url: 'http://qt.nokia.com'

onWidthChanged: updateContentSize(width,height)
onHeightChanged: updateContentSize(width,height)
    }
}

I don't understand why.  Some kind of race condition in the signals, perhaps?

 - Andrew


On Nov 5, 2010, at 5:17 PM, ext Tico Ballagas wrote:

I was trying to create a basic QML Webkit + Flickable proof of concept.


import Qt 4.7

import QtWebKit 2.0


Flickable{

    width: 640; height: 480

    contentWidth: webView.width

    contentHeight: webView.height

    WebView {

        id: webView

        preferredWidth: parent.width

        url: 'http://qt.nokia.com'

    }

}

However, this seems to show a checkerboard... until you scroll.  Once you 
scroll, the content magically appears.  I've tried this on both Linux and Mac 
and get the same result.   What am I doing wrong?

Best
-Tico
<ATT00001..txt>

<ATT00001..txt>

_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to