[Qt-qml] Using ListView and Flickable element as delegate

Girish Ramakrishnan girish at forwardbias.in
Mon Feb 21 20:02:32 CET 2011


Hi Rachel,

On Mon, Feb 21, 2011 at 10:46 PM, <rachel.liu at orange-ftgroup.com> wrote:

>  Hi,
>
>
>
> I am struggling to do the following and hope there is something who might
> have come across a similar scenario in what I am trying to achieve. As a
> result, my main question is if there’s a way to support horizontal swiping
> as well as vertical scrolling of the article?
>
>
>
> My current implementation involves the following format and works fine. The
> purpose of this is being able to swipe through different articles in the
> model given.
>
>
>
> ListView {
>
>                 orientation: ListView.Horizontal;
>
>                 Delegate: ArticleViewDelegate {
>
> }
>
> }
>
>
>
> The ArticleViewDelegate has the following format which is quite simple:
>
> Rectangle {
>
> Image {}
>
> Text {}
>
> Image {}
>
> Text {}
>
> }
>
>
>
> Currently, the text for the article is too long, therefore I wanted to use
> the Flickable element and just alter the ArticleViewDelegate but this
> doesn’t seem to work very easily. I’ve been experimenting with just the
> article text as an example delegate as follows:
>
>
>
>         delegate: Rectangle {
>
>             anchors.fill: parent;
>
>             Flickable {
>
>                 id: flickableView;
>
>                 anchors.fill: parent;
>
>                 contentWidth: childrenRect.width; contentHeight:
> childrenRect.height
>
>
I think the above is the source of the problem. It should read
contentItem.childrenRect.width/height since Flickable reparents it's
children into contentItem.

Girish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110222/ddfd2e78/attachment.html 


More information about the Qt-qml mailing list