【发布时间】:2020-10-24 13:17:36
【问题描述】:
我有一排带有按钮的列表视图委托。单击按钮时,我需要在该按钮下方打开一个对话框。我尝试了 mapToItem 属性并部分成功,但此列表视图是可滚动的,并且在滚动对话框时,它会保持在其初始位置。不确定如何让它工作。此外,发布问题的新手。如果我含糊不清,请忽略并帮助我。
我要打开的对话框位于此委托之外。我提供了我的代码的简短大纲。
Listview{
delegate: Row{
Button1{
}
Button2{
id: button2Id
onCheckedChanged{
var coords = button2Id.mapToItem(null,0,0)
dialogId.x = coords.x
dialogId.y= coords.y
dialogId.visible = true
}
}
}
}
//dialog rect outside of my listview
Rectangle{
id: dialogId
}
【问题讨论】: