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. Unsigned char to QString
Qt 6.11 is out! See what's new in the release blog

Unsigned char to QString

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 7.6k 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.
  • A Offline
    A Offline
    aurquiel
    wrote on last edited by
    #1

    Hello i was checking the functions of QString most of them work with const char parameters.

    I tried google and not found a solution for this, i tried ones but wasn't successful.

    I have this

    .
    .
    .
    .
    .
    unsigned char *datarx = new unsigned char[4]; //data to read
    
    
    QString data;
    for (int n=0;n<4;n++)
     {
             data=(QChar(datarx[n]));
     }
    .
    .
    .
    .
    .
    
    
    1 Reply Last reply
    0
    • E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      So what you want to achieve?

      A 1 Reply Last reply
      0
      • E Eeli K

        So what you want to achieve?

        A Offline
        A Offline
        aurquiel
        wrote on last edited by aurquiel
        #3

        @Eeli-K said in Unsigned char to QString:

        So what you want to achieve?

        I want to display that array in a listWidget i usually do this

        QString error="no recive successful";
        ui->listWidget->addItem(error);
        
        1 Reply Last reply
        0
        • JohanSoloJ Offline
          JohanSoloJ Offline
          JohanSolo
          wrote on last edited by JohanSolo
          #4
          QString data( reinterpret_cast< char* >( datarx ) );
          

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          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