uonedb-qt team mailing list archive
-
uonedb-qt team
-
Mailing list archive
-
Message #00002
Re: Using U1Db-Qt without a ListView
On 2013-03-06 11:50, Christian Dywan wrote:
> On 2013-03-06 09:41, Kevin Wright wrote:
>> While developing one of the U1Db-Qt examples I came across a situation
>> where I didn't necessarily want to use a ListView, because I only
>> wanted to retrieve one known document.
> Instead of a ListView I suggest directly using the TextField on its own
> (incomplete snippet):
>
> U1db.Document { id: aDocument
> create: true
> defaults: { "sound": "off", "music": "off" }
> TextField { text: aDocument.contents.sound }
>
> I think there may be a bug related to saving, so currently it probably
> fails to update as you type. I'll investigate it.
As of r33 I fixed a bug with saving changes of Document.contents.
For bi-directional changes, it should be something like this:
aDocument { …
onContentsChanged: soundSetting.text = contents.sound
… }
TextField { id: soundSetting; onAccepted: {var foo = aDocument.contents;
foo.sound = text; aDocument.contents=foo } }
The earlier example still works perfectly for displaying values in a
Label or the like.
ciao,
Christian
ciao,
Christian
Follow ups
References