If it's a non-release build that seems fine, but do you have a way to disable this in release builds? Even if the object doesn't show, since QML may be loaded dynamically, having these scattered around could slow your app.
I still remember optimizing customer code bases that suffered from horrible startup performance because they instantiated thousands of debug rects unconditionally all the time...