nikonice |
2018-05-30 16:46 |
qml listview 横向滑动问题
qml listview 显示的列比较多,显示不全,做了个横向滚动条,代码如下,但不好使,拖动底部滚动条,上面的listview并不动,但上下滚动条的可以滚动,帮忙看看横向滚动的代码哪里有问题 [attachment=19041] // 滚动条 Rectangle { id: scrollbar x: 400; y:0 width: 10; height: 380 color: "#ccbfbf" radius: 10 // 按钮 Rectangle { id: button x: listView.visibleArea.xPosition * scrollbar.width y: 0 width:155 height:130 color: "#818b81" radius: 10 // 鼠标区域 MouseArea { id: mouseArea anchors.fill: button drag.target: button drag.axis: Drag.XAxis drag.minimumX: 0 drag.maximumX: scrollbar.width- button.width // 拖动 onMouseXChanged: { listView.contentX = button.x / scrollbar.width * listView.contentWidth } } } } |
|