Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to convert pointer of qint8 to qstring ?
Forum Updated to NodeBB v4.3 + New Features

How to convert pointer of qint8 to qstring ?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dabla24
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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);
      @

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved