Important: Please read the Qt Code of Conduct -

QStringList to QByteArray??

  • Is there aby way how to pass QStringList to QByteArray? And then back, from QByteArray to QStringList?

  • What about serialization like?:

    QByteArray ba;
    QDataStream ds(&ba);
    ds << my_stringlist;

    QByteArray ba;
    QDataStream ds(&ba);
    ds >> my_stringlist;

  • May be.

    // edit: or:
    QByteArray tmp;
    for(int i = 0; i < args.count(); i++) {

  • Moderators

    Did you read the documentation? There are quite some ways to get a QByteArray from a QString and a QString from a QByteArray listed in the documentation of QString.

    Which one you want to use depends on which encoding you want/have in your QByteArray.

  • Tobias, he is asking not about conversion, but more about (de)serialization (QStringList <> QByteArray, not QString <> QByteArray) :) . Previous answers are quite full I think

Log in to reply