Important: Please read the Qt Code of Conduct -

[SOLVED] Error using QByteArray

  • Hello,

    I am facing an error which i am unable to fix...

    Here what i have :

    in my .h

    QMap<qint8, qint8> patch;

    in my .cpp

    void matrix::updatePatch() {
       QByteArray resp = sendQuery("#VID? *\r");
       resp.remove(0, 8);
       QList<QByteArray> inouts = resp.split(',');
       for(int i = 0; i < inouts.size(); i++)
           QList<QByteArray> tie ='>');
           patch.insertMulti(QByteArray::number(, QByteArray::number(;

    Compiler throws me the following error :

    'operator int' is a private member of 'QByteArray'
    patch.insertMulti(QByteArray::number(, QByteArray::number(;

    Any help appreciated

  • QByteArray::number() takes an int and creates a QByteArray of the string equivalent of that int, but it appears you want to do the opposite; convert a QByteArray to an int.


  • SILLY ME !!!
    My bad.
    Obviously this is the way i should have done it.

    thanks a lot for having put my brain in its right place

Log in to reply