QTypedJson: don't confuse WorkDoneProgress(Report|Done)


It seems that we serialize a WorkDoneProgressReport from a JSON
describing a WorkDoneProgressDone struct. This interchange happens
because both WorkDoneProgressReport and WorkDoneProgressDone have
the same set of non-optional fields, and only differ by the value
they have in their kind member. The QTypedJson code that loads a
`std::variant<WorkDoneProgressReport, WorkDoneProgressDone, ...>`
from JSON used to construct a WorkDoneProgressReport with member
'kind' set to "end" instad of "report".

To fix this, support const strings in QTypedJson, and fail the
deserialization when a const member's content in the JSON is not
equal to its hardcoded value. This fail makes the handleVariant()
method select the right struct.

Add a method "handleConstString" because methods taking a
QByteArrayView can't be overloaded with a method taking a bool, and
handleBasic() already has an overload that takes a bool.

Task-number: QTBUG-142352
Change-Id: Ifaf927ceb6f2d5d62204b9ff7a40a0a1c2afb8f4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
commitd342df0910eff54c1370ffee23d243a871b20f4c
parent1a4691501796f3e7c97c92d4a26da2e36f27427a
authorSami Shalayel <sami.shalayel@qt.io>
committerSami Shalayel <sami.shalayel@qt.io>
commit timeMon, 19 Jan 2026 12:05:25 +0100