Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Pass QByteArray to Qml Text
Qt 6.11 is out! See what's new in the release blog

Pass QByteArray to Qml Text

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.1k Views
  • 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
    Damian7546
    wrote on last edited by
    #1

    Hi,
    In my qt code I emit QByteArray. How properly display my bytes in Text on Qml ?
    I try like this :

    function onSelectId(arrayId) {
                text1.text = arrayId
            }
    

    Where arrayId is my QByteArray
    But bushes are displayed.

    JonBJ 1 Reply Last reply
    0
    • D Damian7546

      Hi,
      In my qt code I emit QByteArray. How properly display my bytes in Text on Qml ?
      I try like this :

      function onSelectId(arrayId) {
                  text1.text = arrayId
              }
      

      Where arrayId is my QByteArray
      But bushes are displayed.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @Damian7546
      Do you mean your QByteArray contains bytes which are genuine string characters (so could be displayed as-is, just converted to a QString), or do you mean they are arbitrary bytes and you actually want to display, say, their hex values instead?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Damian7546
        wrote on last edited by
        #3

        I want to display bytes from this array in hex values for example:
        0x05 0x06 0x77 0x44

        JonBJ 1 Reply Last reply
        0
        • D Damian7546

          I want to display bytes from this array in hex values for example:
          0x05 0x06 0x77 0x44

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @Damian7546
          So if you searched the QByteArray documentation page for hex you would hit QByteArray QByteArray::toHex(char separator = '\0') const !

          1 Reply Last reply
          2
          • D Offline
            D Offline
            Damian7546
            wrote on last edited by
            #5

            It works. Thanks.

            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