View Single Post
Posts: 301 | Thanked: 531 times | Joined on Aug 2010 @ The Netherlands
#107
Is there a way to force a ListModel to refresh, when the database records have been changed?

I have a page, where the ListModel is filled by a JS function getting a SELECT from a SQLite database. It is a list of letters, with a possible value, e.g. A="3", B="".
After some experiments with TextFields I chose for Buttons. Then a Dialog opens, where the value can be changed.

However, after the change, the Button does not show the new value of the letter. Can I force an update? Maybe by a signal from the PageStack that the current page has become visible again?

The Button is now configured like:
Code:
Button {
	height: Theme.itemSizeMedium
	preferredWidth: Theme.buttonWidthLarge
	anchors.horizontalCenter: parent.horizontalCenter
	text: letter + " = " + (lettervalue === "" ? "<?>" : lettervalue) + qsTr(". Click to change")
	onClicked: {
		generic.lettEdit  = letter
		pageStack.push(Qt.resolvedUrl("LetterPage.qml"),
					   {"lettervalue": lettervalue})
		listModelLett.updateLett();
	}
}
Attached Images
 
__________________
Palm Treo -> N900 -> N9 -> Jolla -> SailfishX -> XA2
Developer mode novice, and enjoying it

Last edited by rob_kouw; 2020-08-26 at 15:38.
 

The Following User Says Thank You to rob_kouw For This Useful Post: