Commit 514bc3c3 authored by Volker Krause's avatar Volker Krause
Browse files

Emulated Qt5 behavior in dumping the object tree for Qt6

This omits empty-ish objects from the object tree entirely, also with Qt6,
which makes the test results equivalent with both versions. Once we depend
on Qt6 only we can remove those hacks and update the test reference data
accordingly.
parent 1bd6cd0e
Pipeline #182630 passed with stage
in 3 minutes and 7 seconds
......@@ -40,10 +40,18 @@ function dumpValue(value, depth)
if (prop == "parent" || prop == "firstChild" || prop == "nextSibling" || value[prop] === undefined || value[prop] === null || typeof value[prop] == "function") {
continue;
}
obj[prop] = dumpValue(value[prop], depth - 1);
empty = false;
const v = dumpValue(value[prop], depth - 1);
if (v != undefined) { // ### Qt5 behavior compat, remove with Qt6
obj[prop] = v;
}
if (v) { // ### Qt5 behavior compat, remove with Qt6
empty = false;
}
}
if (empty && Object.keys(obj).length >= 1) {
return undefined; // ### Qt5 behavior compat, remove with Qt6
}
// implicitly convertible (color, date, opaque types, etc)
if (empty) {
let s = value.toString();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment