How to convert pointer of qint8 to qstring ?



  • Hi,
    I need to get the string for value of qint8 which is stored in pointer?

    // returns qint8*
    @this->_vol@

    I tried with
    @QString volString = QString("0x%1").arg(this->_vol,0,16);@
    or
    @QString volString = QString::number(this->_vol);@
    and
    volString.setNum(this->_vol)
    but I get every time no matching function


  • Moderators

    if _vol is a function you need to call it ( () ), and if it returns a pointer you need to dereference it ( * ). You don't need to type this-> every time. That's a given.
    @
    //assuming _vol is a member function:
    QString volString = QString::number(*_vol());

    //and if it's just a plain old data member:
    QString volString = QString::number(*_vol);
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.