Skip to content

PromptDialog: Create default contentItem dynamically on demand

ivan tkachenko requested to merge work/ratijas/dialog-padding into master

Porting from QQC2.Control to Kirigami.Padding had an unintended consequence: QtQuickControl uses private API magic to "defer execution" of its contentItem and background properties to delete overridden declarative items at componentComplete() hook, but also it hides unset items regardless of whether or not they'll be deleted later.

Since we can't use deferred pointers (because they are private), we can't delete intermediate/default item, so let's create it imperatively if nothing else was declared by the time a component is completed.

Note: it does not matter which component to hook for completion, as all of them within the creation scope will have all their declarative properties fully initialized by that time, guaranteeing that the mainItem (alias for wrapper.contentItem) will be set.

Merge request reports