[Development] Serialising UI state in QML via QSettings and JSON: QByteArray vs QString

Mitch Curtis mitch.curtis at qt.io
Tue Oct 30 12:29:31 CET 2018


> -----Original Message-----
> From: Edward Welbourne
> Sent: Tuesday, 30 October 2018 11:37 AM
> To: Mitch Curtis <mitch.curtis at qt.io>
> Cc: Qt development mailing list <development at qt-project.org>
> Subject: Re: [Development] Serialising UI state in QML via QSettings and
> JSON: QByteArray vs QString
> 
> Edward Welbourne (Monday, 29 October 2018 7:31 PM) wrote
> >> I'm not sure where JSON got involved in that
> 
> Mitch Curtis (30 October 2018 08:37) replied
> > What do you mean? It's in the title of the email; it's a popular
> > choice for storing data like this, so I want SplitView's serialisation
> > to be compatible with it.
> 
> Perhaps I need to rephrase: to what extent is the choice of JSON, in the
> present discussion, necessary or incidental ?  If what you're trying to do has
> to use JSON with QSettings, then it's necessary.  If JSON just looked, at first
> sight, like it would solve your primary problem, then it's incidental and can be
> replaced by something compatible.
> 
> 	Eddy.

I want users to be able to call SplitView's saveState() function and store the result in a JSON file. To do that, it needs to be able be stored in a QVariant because QJsonObject isn't exposed to QML. The next issue for users would be the lack of ability to convert that QVariant into a QJsonObject.

By the way, QCborValue and friends is working quite well so far. :)



More information about the Development mailing list