[英]QML ListView : “complex” delegate causes crash
我的應用程序出現問題時,我已經在網上搜索了一些東西(甚至是遠程的),並且發現了這一點: 從QAbstractListModel (答案中提供的代碼)中刪除行 -效果很好! 但是,當我將ListView
委托更改為更“復雜”的東西時,如下所示:
Component {
id: commonDelegate
Rectangle {
width: view.width
implicitHeight: editor.implicitHeight + 10
color: "transparent"
border.color: "red"
border.width: 2
radius: 5
TextInput {
id: editor
anchors.margins: 1.5 * parent.border.width
anchors.left: parent.left
text: edit.name // "edit" role of the model, to break the binding loop
onTextChanged: {
display.name = text;
model.display = display
}
}
ComboBox {
id: siema
anchors.left: editor.right
model: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "+"]
}
Button {
id: bt
text: "Guizk"
anchors.left: siema.right
anchors.right: parent.right
}
}
}
然后在添加一些行(試圖填充整個屏幕,使其中一些不可見)並嘗試滾動到那些不可見的行后,應用程序崩潰。 使用調試器運行時,報告的錯誤為EXC_BAD_ACCESS
並且在Creator中顯示了針對功能QCoreApplication :: proccessEvents的反匯編。
委托人的“復雜程度”是否有限制? 還是有一種更好(更有效)的方法來避免崩潰?
該崩潰發生在Windows 7 64位,OsX 10.8.5和Android 4.1上
如果您需要更多信息,請與我們聯系。
通過反復試驗,我遇到了同樣的問題,即Combobox對崩潰負責。
如果您可以沒有它,請盡量不要使用它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.