【发布时间】:2017-08-04 09:45:13
【问题描述】:
我在底部有一个可轻弹的场景“编辑器”,停靠在其右侧,顶部有一个可轻弹的场景“大纲”,它显示了场景结构的树。
Flickable {
id: editor
anchors.fill: parent
contentWidth: 5000
contentHeight: 5000
Repeater {
model: 500
delegate: Rectangle {
width: Math.random() * 200 + 50
height: width
x: Math.random() * editor.contentWidth
y: Math.random() * editor.contentHeight
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
border.color: "black"
}
}
}
Flickable {
id: outliner
anchors.right: editor.right
width: contentWidth
height: parent.height
contentWidth: contentItem.childrenRect.width
contentHeight: contentItem.childrenRect.height
Column {
Repeater {
model: 500
delegate: Rectangle {
width: Math.random() * 200 + 50
x: outliner.contentWidth - width
height: 50
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1)
border.color: "black"
}
}
}
}
当然,我希望能够同时滑动两者来导航,因为它们都比可用的屏幕空间更大。
问题是大纲可轻弹只会阻止编辑器轻弹,即使我从大纲项目不占据的位置轻弹。我不希望这样,我想要的是仅当轻弹发生在大纲项目顶部时才轻弹大纲,否则我想跳到编辑器,所以我可以单击并将其从该区域轻弹到对。
由于Flickable 的工作方式,我无法做到这一点。它会首先检查是否有拖动,只有当点击不超过拖动阈值时,它才会让点击向下到底层元素。所以我想不出只有在那个位置有物体时才轻弹的方法。
有什么方法可以让事件处理做我想做的事吗?
【问题讨论】:
-
它在这里工作zippy.gfycat.com/FamiliarFavoriteCricket.webm 或者你的意思是它不应该在没有代表的大纲区域轻弹时轻弹?
-
这就是我的意思。不仅它不应该轻弹,而且底部的轻弹也应该轻弹。
标签: qt qml qtquick2 overlap flickable