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. Clear QJson Objcts/Arrays
Forum Updated to NodeBB v4.3 + New Features

Clear QJson Objcts/Arrays

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 7.1k Views 2 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.
  • Flaming MoeF Offline
    Flaming MoeF Offline
    Flaming Moe
    wrote on last edited by
    #1

    Hello on the other screen,

    i´m looking for a way to clear QJson Objects/Arrays. My OS is Windows 7.
    My situation is, that i´m implementing a statemachine which is doing measurments in each case and the machine is triggered cyclic.
    So i can´t use Json Objects/Arrays in this way "QJsonObject myObjct" because it would vanish at the end of every cycle.
    I tried to do it by using dynamic allocation, but it feels like the envoironment doesn´t like that.
    When i make it like "static QJsonObject myObjct" i guess i would have to clear the Objects/Arrays for the next sequence when all measurements are done and saved to the file.
    How do i clear the Json Obcts/Arrays? Especially i´m asking because i´m not sure what happens behind the scenes and what i have to take into consideration when appending Objects to arrays and assining arrays to objects.

    best regards,
    Moe

    A lovely day for a ̶g̶̶u̶̶i̶̶n̶̶n̶̶e̶̶s̶ DUFF^^

    JKSHJ 1 Reply Last reply
    0
    • Flaming MoeF Flaming Moe

      Hello on the other screen,

      i´m looking for a way to clear QJson Objects/Arrays. My OS is Windows 7.
      My situation is, that i´m implementing a statemachine which is doing measurments in each case and the machine is triggered cyclic.
      So i can´t use Json Objects/Arrays in this way "QJsonObject myObjct" because it would vanish at the end of every cycle.
      I tried to do it by using dynamic allocation, but it feels like the envoironment doesn´t like that.
      When i make it like "static QJsonObject myObjct" i guess i would have to clear the Objects/Arrays for the next sequence when all measurements are done and saved to the file.
      How do i clear the Json Obcts/Arrays? Especially i´m asking because i´m not sure what happens behind the scenes and what i have to take into consideration when appending Objects to arrays and assining arrays to objects.

      best regards,
      Moe

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @Flaming-Moe said:

      How do i clear the Json Obcts/Arrays?

      Just assign an empty object/array to your variable:

      myObjct = QJsonObject();
      

      Or, use QJsonObject::erase()/QJsonArray::erase()

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      1

      • Login

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