要为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不能滚动(在verticle中)。
谁能告诉我如何使闪烁的项目在列表视图中可滚动。非常感谢你的帮助。
发布于 2016-11-25 19:03:52
我知道这个问题有点过时了,解决方案可能是更新到更新的QtQuick 2.5。但我已经尝试过达到你所描述的-- you could take a look at the code at GitHub。你也可以看看它是如何工作的here。
https://stackoverflow.com/questions/11046885
复制相似问题