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. QJsonObject.insert("long-name") creates truncated key. How can I get around this?
Forum Updated to NodeBB v4.3 + New Features

QJsonObject.insert("long-name") creates truncated key. How can I get around this?

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

    I have a QJsonObject that already has a key

    "data-source-storages"
    

    I use the following statement to replace the value connected to that key:

    obj.insert("data-source-storages", dataSourceStorages);
    

    After this statement has executed the debugger shows that the QJsonObject now has a key with the truncated name

    "data-sourc"
    

    instead of

    "data-source-storages"
    

    Why is this happening? How can I replace a value without clipping the key?

    jsulmJ 1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Sounds like a bug. Which Qt version are you using? What operating system? Can you try some other long string - is behaviour the same?

      (Z(:^

      1 Reply Last reply
      0
      • P pokemonsrqt

        I have a QJsonObject that already has a key

        "data-source-storages"
        

        I use the following statement to replace the value connected to that key:

        obj.insert("data-source-storages", dataSourceStorages);
        

        After this statement has executed the debugger shows that the QJsonObject now has a key with the truncated name

        "data-sourc"
        

        instead of

        "data-source-storages"
        

        Why is this happening? How can I replace a value without clipping the key?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @pokemonsrqt I doubt the key is really truncated, I guess it is simply the dubugger showing it this way for some reason.
        Did you try to print out the Json string?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        5
        • P Offline
          P Offline
          pokemonsrqt
          wrote on last edited by
          #4

          I'm using macOS 10.13.6, Qt Creator 4.7.2 and Qt 5.11.2.

          The application works, so it seems that it is only the debugger showing the wrong value as @jsulm figured. I won't pursue this issue any further.

          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