[Qt-qml] Basic QML Webkit + Flickable not working
Tico Ballagas
ballagas at gmail.com
Tue Nov 9 06:02:27 CET 2010
Looks like we were revisiting this at the same time. Yes, the following works correctly:
import Qt 4.7
import QtWebKit 1.0
Flickable{
id: myflickable
width: 640; height:480
contentWidth: webView.width
contentHeight: webView.height
WebView {
id: webView
preferredWidth: myflickable.width
preferredHeight: myflickable.height
url: 'http://qt.nokia.com'
}
}
I guess the idea is that Flickable has a contentItem that is of size (contentWidth, contentHeight), which results in a circular reference with preferredWidth / preferredHeight. I wonder if there is a way to warn us of the circular reference.
-Tico
On Nov 8, 2010, at 8:38 PM, ext michael.brasser at nokia.com wrote:
> Hi,
>
> On 06/11/2010, at 7:17 AM, 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?
>
> Does it work correctly if you give the Flickable an id, and bind WebView's preferredWidth to myFlickable.width rather than parent.width? Items added in a Flickable become a child of the Flickable's contentItem rather than the Flickable itself, which may be causing the problem (parent.width is binding to the contentItem's width rather than the Flickable's width).
>
> Regards,
> Michael
>
> <ATT00001..txt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20101108/fc0be73e/attachment.html
More information about the Qt-qml
mailing list