Important: Please read the Qt Code of Conduct -

Updating a reference to a QString

  • Hello,

    I have a function which works, but I don't know how to return the result : question inside :

    @ QString & CMyClass::CustomFunction(const QString & s)
    QByteArray ba = s.toLocal8Bit();
    const char *c_s =;
    // various operations on c_s...
    QString sResult = QString::fromLocal8Bit(c_s);

    • // But how to convert back sResult to s ?*

    return (this->*OriginbalFunction)(s);


  • I found it
    (by returning QString::fromUtf8() after having updated the Byte Array ba)

Log in to reply