> -----Original Message----- > From: Development <development-bounces+mitch.curtis=qt.io@qt- > project.org> On Behalf Of Mitch Curtis > Sent: Tuesday, 30 October 2018 3:04 PM > To: J-P Nurmi <jpnu...@gmail.com> > Cc: development@qt-project.org > Subject: Re: [Development] Serialising UI state in QML via QSettings and > JSON: QByteArray vs QString > > > -----Original Message----- > > From: J-P Nurmi <jpnu...@gmail.com> > > Sent: Tuesday, 30 October 2018 2:49 PM > > To: Mitch Curtis <mitch.cur...@qt.io> > > Cc: development@qt-project.org > > Subject: Re: [Development] Serialising UI state in QML via QSettings > > and > > JSON: QByteArray vs QString > > > > On Mon, Oct 29, 2018 at 5:42 PM Mitch Curtis <mitch.cur...@qt.io> wrote: > > > I thought that I could get around this by using Qt.atob() and > > > Qt.btoa() in > > QML to convert the byte array into a Base64 QString, but it turns out > > that those functions expect a string: > > > > > > http://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qml/qml/v8/qqml > > > bu > > > > > > iltinfunctions.cpp?h=5.12&id=475c74a9926efcd968572563e678988e53804603# > > > n996 > > > > Hi Mitch, > > Hey. :) > > > So Qt.atob() and Qt.btoa() are not doing what they claim to do? Would > > it be feasible to fix them? > > Their documentation doesn't claim that they operate on a specific type, so > I'm not sure it's a matter of not doing what they claim to do.
Correcting myself here; the docs say "string": "ASCII to binary - this function decodes the base64 encoded data string and returns it." - http://doc.qt.io/qt-5/qml-qtqml-qt.html#atob-method > Whether or not they could be extended to work with byte arrays is a > question I don't have the answer to, though presumably it would involve > modifying QV4::Value and who knows what else in the guts of QML. > > Unfortunately it wouldn't help the use case I'm trying to support though, > because there is still the problem of Qt's JSON implementation not > supporting byte arrays. > > What do you think about the proposed solution of saveState() returning a > Base64 QString? > > > -- > > J-P Nurmi > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development