Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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 = ba.data();
    // various operations on c_s...
    QString sResult = QString::fromLocal8Bit(c_s);

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

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

    Thanks.



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


Log in to reply