그의 모델이 U1db에서 오는 ListView가 있습니다. 쿼리 U1db와의 읽기 및 저장 작업은 작동하지만 새 항목을 삽입 할 때 ListView 모델을 업데이트해야합니다. 삽입 된 마지막 컨텐츠를 표시하는 데이터베이스 (예 : 동일한 쿼리를 실행해야 함). 나는 또한 ListView 및 UbuntuListView` 시도했지만이 문제를 해결할 수 없습니다. 난 '당겨'하면 목록은 내가 오류를 새로 고침 : 나는 SDK의 문서에서 보았다하지만 난 어떤 유용한 예제를 발견하지 않았습니다우분투 qml ListView 모델 새로 고침 U1Db 쿼리
Property 'update' of object U1db::Query(0xe097e0) is not a function
. 어떤 제안을 주셔서 감사합니다! 여기에 조각
는 (좀 detils를 생략 한) :import QtQuick 2.2
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import Ubuntu.Components.ListItems 1.3 as ListItem //test
import U1db 1.0 as U1db
//the delegate component used by the ListView
Component {
id: peopleListDelegate
Item {
id: personItem
//draw a rectangle aroun the content to display
Rectangle {
//content omitted
}
// This mouse region covers the entire delegate
MouseArea {
//content omitted
}
Row {
id: topLayout
//display some content to be shown inside the Rectangle
}
}
}
//the listView that show the DB Query result
ListView {
id: listView
anchors.fill: parent
model : allPeopleQuery
delegate: peopleListDelegate
highlight: highlightComponent
focus: true
Component{
id: listHeader
Item {
width: parent.width
height: units.gu(10)
Text{
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
text: i18n.tr("<b> Total people found: </b>") + listView.count
}
}
}
header: listHeader
PullToRefresh {
refreshing: listView.model.status === ListModel.Loading
onRefresh: listView.model.update() // HERE THE PROBLEM, (also using reload() doesn't work)
}
}
U1db.Database {
id: mypeopleDb
.....
}
U1db.Index{
database: mypeopleDb
id: all_field_index
expression: .......
}
U1db.Query {
id: allPeopleQuery
index: all_field_index
query: ["*", "*"]
}