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

qml: DelegateModel + Package makes delegate have null parent transiently

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.1
    • Quick: Other
    • None
    • Linux/X11

    Description

      When using using Package, State and ParentChange to re-parent a delegate to one of several views, the delegate, perhaps when first instantiated (??) has a null parent; if the delegate has bindings such as "width: parent.width" then an error occurs.

      However parent is never null when either Component.onCompleted or onParentChanged is triggered; so it seems to be a problem with the initial state, while bindings are first evaluated, immediately after the delegate of a DelegateModel is instantiated.

      NOTE: Qt's example for using Package in QtQuick 2.14 exhibits this same problem if the initial state is 'inGrid' instead of 'inList'.  To demo this, copy ..../Qt/Examples/Qt-5.14.1/quick/views/package/{view.qml,Delegate.qml} and change the initial upTo value from 0 to 7 in view.qml and then run "qmlscene view.qml".

      Also discussed in https://stackoverflow.com/questions/61605859/qml-delegatemodel-package-makes-delegate-have-null-parent-transiently

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jimav Jim Avera
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes