Re: [Qt-qml] Basic QML Webkit + Flickable not working

2010-11-08 Thread michael.brasser
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

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


Re: [Qt-qml] Basic QML Webkit + Flickable not working

2010-11-08 Thread tico.ballagas
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.commailto: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
ATT1..txt

ATT1..txt

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


Re: [Qt-qml] Basic QML Webkit + Flickable not working

2010-11-08 Thread Tico Ballagas
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.bras...@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
 
 ATT1..txt

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


[Qt-qml] Basic QML Webkit + Flickable not working

2010-11-05 Thread Tico Ballagas
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___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml