How to change QJsonObject value in a QJson hierarchy without using copies?

前端 未结 3 1342
有刺的猬
有刺的猬 2021-02-12 15:24

I am currently using Qt5.0 with the core QJson library to handle some data for the program I am developing.

To set the scene for this question I will provide you with so

3条回答
  •  半阙折子戏
    2021-02-12 16:19

    I have had a similar problem for a couple of days and I have managed to find a workaround which works for me and I thought I should share it here.

    You can navigate to the object whose key-value you wish to update. Then use the "remove" method to delete the key-value pair and then use the "insert" method to insert it again with the new value.

    This might ruin the order of key-value pairs in your object but since you will anyways access by a key, it should not be a problem.

    The in-place changing of values is not supported as I found out the hard way :)

提交回复
热议问题