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.

anticafe
  • 6,816
  • 9
  • 43
  • 74

1 Answers1

0

I know that this question is a bit outdated, and the solution could be just update to newer QtQuick 2.5. But I've tried to reach what you described -- you could take a look at the code at GitHub. Also you could take a look at how it is working here.

NG_
  • 6,895
  • 7
  • 45
  • 67