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. binary Representation in 8 Bits.
Forum Updated to NodeBB v4.3 + New Features

binary Representation in 8 Bits.

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 700 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.
  • M Offline
    M Offline
    Marco Flad
    wrote on last edited by
    #1

    converting Q String to Binary the Final result in Debug Each byte Represented in in 4-bit (0000)
    but when append data to "Text-browser" represented in 8bits (0000 0000)
    So the same Function in debug and text Browser why it diffrent ? i want to represent in 8 bit so i can use it .
    here is the Debuger Output :

    "10101010000000111111111000000011111111010000000010000010011110"
    

    the Text-browser output in image :
    alt text

    coding :

     //Debug 
         QString s = QString("%1").arg(DataAsString.toULongLong(&ok1, 16), 8, 2, QChar('0'));
         qDebug() << "s = " <<s;
    //text brawser 
        ui->textBrowser->append("Status data received - " + QString::number(SerialbufTest.length()) + " bytes.");
         // Display bytes in debug window
         for (int i=0; i<SerialbufTest.length(); i++) {
            DataAsString = SerialbufTest[i];
             ui->textBrowser->append("Byte" + QString::number(i+1) + ":" + QString("%1").arg(DataAsString.toULongLong(&ok1, 16),8, 2, QChar('0')));
         }
    

    Thanks,

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      As silly as it may sound, but in the first one you are sending everything at once while in the second case you are iterating through each value contained in that QByteArray.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      2
      • SGaistS SGaist

        Hi,

        As silly as it may sound, but in the first one you are sending everything at once while in the second case you are iterating through each value contained in that QByteArray.

        M Offline
        M Offline
        Marco Flad
        wrote on last edited by
        #3

        @SGaist
        Hi , Iam Sorry iam new in C++ This is stupidity from me :D
        Thank;

        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