[Qt-qml] Flickable WebBrowser: how to update contentY property when user clicks on a same-page anchor ?

Martin Jones martin.jones at nokia.com
Wed Sep 8 08:59:03 CEST 2010


It looks like an oversight to me too.  Please log a bug.

BR,
Martin.

On Wed, 8 Sep 2010 04:21:42 am ext Sacha Zyto wrote:
> Good afternoon
> 
> I have a WebView embedded inside a Flickable, and I'm trying to move the
> page appropriately when a user clicks on a link that's an anchor to the
> same page, such as:
> 
> <a href="#references">Jump to References</a>
> 
> I looked at the source code in demos/declarative/webbrowser, but I fear
> that they may have forgotten about the use of links for that purpose,
> since the code in FlickableWebView looks like:
> 
> (...)
>        onUrlChanged: {
>              // got to topleft
>              flickable.contentX = 0
>              flickable.contentY = 0
>              if (url != null) { header.editUrl = url.toString(); }
>          }
> (...)
> 
> contentY shouldn't typically be set to 0 if the url changes just by the
> anchor part (i.e. from http://www.example.com#section1 to
> http://www.example.com#section2). My question is: Does the QML WebView
> element exposes enough of its state in its API so that we can actually
> scroll to the right place on the page ? If not, shouldn't we submit a
> bug report or feature request ?
> 
> Example:
> Use the demos/declarative/webbrowser QML example and visit
> http://en.wikipedia.org/wiki/Uniform_Resource_Locator
> ... and try any of the "Contents" link: Instead of scrolling to the
> right place on the page, it will go back to the top of the document.
> 
> Best,
> Sacha
> 
> _______________________________________________
> 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