【问题标题】:QML listview: Flickable as delegate cannot be scrollableQML listview:Flickable作为委托不能滚动
【发布时间】:2012-06-18 07:12:01
【问题描述】:

要为 Qt 制作类似 Android ViewPager,我使用这样的列表视图:

ListView {
        id: myListViewArticle
        anchors.fill: parent

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

还有一个 Flickable 作为它的代表:

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
            }
        }
    }

但是在为 listview 填充数据后,我看到 Flickable 不能滚动(垂直)。

谁能告诉我如何使 Flickable 项目在列表视图中可滚动。非常感谢您的帮助。

【问题讨论】:

    标签: qt listview delegates qml flickable


    【解决方案1】:

    我知道这个问题有点过时了,解决方案可能只是更新到更新的 QtQuick 2.5。但我试图达到你所描述的——you could take a look at the code at GitHub。 你也可以看看它是如何工作的here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-04
      • 1970-01-01
      • 2016-03-16
      • 1970-01-01
      • 1970-01-01
      • 2016-08-04
      • 1970-01-01
      相关资源
      最近更新 更多