Please see the attached example.
When Qml Grid elements are declared in the Component - grid spacing works fine. But when the elements are created dynamically - spacing is ignored. See the attached screenshot.
qt-5.13.2