Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112376

QQuickView::SetSource doesn't set the parent immediately

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0 RC
    • None
    • All

    Description

      when loading a qml file with QQuickView::setSource, at he time the item executes Component.onCompleted the item still has no parent, only afterwards it will be set to QQuickWindow::contentItem(), but code that relies on a parent and a window to be there at item creation, like QtQuickControls Dialog will be broken.

      so if a Dialog is created inside an item loaded this way, calling open() on it will have no effect.

       

      The problem can be kinda worked around by doing

      setInitialProperties(QStringLiteral("parent"), QVariant::fromValue(contentItem()));

      prior to setSource

      Attachments

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            notmart Marco Martin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: