gpt4 book ai didi

qt - QML ListView : Flickable as delegate cannot be scrollable

转载 作者:行者123 更新时间:2023-12-03 17:56:25 24 4
gpt4 key购买 nike

要为 Qt 制作类似 Android ViewPager 的内容,我使用了这样的 ListView :

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 项目在 ListView 中可滚动。非常感谢你的帮助。

最佳答案

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

关于qt - QML ListView : Flickable as delegate cannot be scrollable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11046885/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com