5

To make a Android ViewPager-like for Qt, I use a listview like this:

ListView {
        id: myListViewArticle
        anchors.fill: parent

        focus: true
        highlightRangeMode: ListView.StrictlyEnforceRange
        orientation: ListView.Horizontal
        snapMode: ListView.SnapOneItem
        model: modelArticles
        delegate: articleDelegate
    }

And a Flickable as its delegate:

Component {
        id: articleDelegate
        Item {
            id: item
            width: 480; height: 800

            Flickable {
                id: mainScrollView
                contentHeight: 1500
                contentWidth: parent.width
                anchors.fill: parent
                clip: true

                Text {
                    id: idArticleContent
                    text: articleContent
                    width: parent.width
                    font.pixelSize: 20
                    font.bold: true; color: "black"
                    wrapMode: Text.Wrap
                }
            }

            ScrollDecorator {
                flickableItem: mainScrollView
            }
        }
    }

But after populate data for listview, I see the Flickable cannot be scrollable (in verticle).

Can anyone tell me how to make Flickable item scrollable inside a listview. Thanks so much for your help.

4

1 回答 1

0

我知道这个问题有点过时了,解决方案可能只是更新到更新的 QtQuick 2.5。但我已尝试达到您所描述的内容——您可以查看 GitHub 上的代码。你也可以看看它是如何在这里工作的。

于 2016-11-25T11:03:51.550 回答