paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
2.92k stars 795 forks source link

bug: `QJsonValueConstRef` in UndoCommands.cpp #353

Closed zmoth closed 1 year ago

zmoth commented 1 year ago

UndoCommands.cpp insertSerializedItems 77 and 90

77 for (QJsonValueConstRef node : nodesJsonArray)
...
90 for (QJsonValueConstRef connection : connJsonArray)
...

in this commit https://github.com/paceholder/nodeeditor/commit/4767ddb416f7a192991d53d63cbadb17ceb5716e

Hi @paceholder , Compilation does not pass, please fix as soon as possible.

I did not find a description of the class QJsonValueConstRef in the qt documentation.

paceholder commented 1 year ago

Sorry for that. It must be something from Qt6 which I have on my computer. Will fix immediately

paceholder commented 1 year ago

The type name is mentioned here but is not documented properly yet

https://doc-snapshots.qt.io/qt6-dev/qjsonobject-const-iterator.html#value

zmoth commented 1 year ago

Sorry for that. It must be something from Qt6 which I have on my computer. Will fix immediately

\error C2065: “QJsonValueConstRef”: Undeclared identifiers

my qt version is 6.2.1

You can use either auto or QJsonValueRef

zmoth commented 1 year ago

Why is QJsonValueRef displayed when I use auto auto-completion, is this different from QJsonValue?

paceholder commented 1 year ago

I think QJsonValueRef wraps both types QJsonValue and QJsonObject. You can write into object without explicit casting. I personally find all this classes a bit confusing. But the bug must be solved now

paceholder commented 1 year ago

QJsonValueRef is a helper class for QJsonArray and QJsonObject. When you get an object of type QJsonValueRef, you can use it as if it were a reference to a QJsonValue. If you assign to it, the assignment will apply to the element in the QJsonArray or QJsonObject from which you got the reference.

zmoth commented 1 year ago

Thank you for your explanation