FormLayout: Clean up the code and fix nullable items
Cleanup
More or less noteworthy changes:
- We can totally use typed
property Item item
. - There was a redundant
itemContainer.parent = lay;
assignment.
FormLayout: Fix nullable items
Not the most elegant solution, but it practically fixes almost all type errors on the "Form Layout" page in Kirigami Gallery:
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:351: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:353: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:359: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:361: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:219: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:377: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:349: TypeError: Cannot read property 'enabled' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:350: TypeError: Cannot read property 'visible' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:355: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:357: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:239: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:136: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:298: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:299: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:301: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:302: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:304: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:305: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:308: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:309: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:292: TypeError: Cannot read property 'enabled' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:293: TypeError: Cannot read property 'visible' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:296: TypeError: Cannot read property 'implicitWidth' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:297: TypeError: Cannot read property 'implicitHeight' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:120: TypeError: Value is undefined and could not be converted to an object
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:120: TypeError: Value is undefined and could not be converted to an object
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:136: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:120: TypeError: Value is undefined and could not be converted to an object
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:120: TypeError: Value is undefined and could not be converted to an object
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:351: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:353: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:359: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:361: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:219: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:377: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:349: TypeError: Cannot read property 'enabled' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:350: TypeError: Cannot read property 'visible' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:355: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:357: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:239: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:136: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:298: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:299: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:301: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:302: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:304: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:305: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:308: TypeError: Cannot read property 'Layout' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:309: TypeError: Cannot read property 'Kirigami' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:292: TypeError: Cannot read property 'enabled' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:293: TypeError: Cannot read property 'visible' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:296: TypeError: Cannot read property 'implicitWidth' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:297: TypeError: Cannot read property 'implicitHeight' of null
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:120: TypeError: Value is undefined and could not be converted to an object
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:120: TypeError: Value is undefined and could not be converted to an object
file:///usr/local/kde/lib/qml/org/kde/kirigami.2/FormLayout.qml:136: TypeError: Cannot read property 'Kirigami' of null
There is one more place left, in knownItemsImplicitWidth
binding.
Seems like after destruction components leave a trace in a knownItems
array as an unprintable uninspectable uncomparable something that looks
like "TypeError: Type error" in console.