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

QML TableView: Component.onCompleted runs twice for each rowDelegate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 5.2.1
    • Quick: Controls 1
    • None
    • Windows 7 x64, QT Creator 5.2.1 ANGLE-64 (downloaded from Qt Website)

    Description

      The below simple Component, used as a rowDelegate for a TableView, should
      illustrate the problem. When I run this I get 66 console messages reporting
      that styleData is unavailable, followed by 66 console messages reporting
      that styleData is available. As long as I test for a completed styleData within the handler, my app runs fine. Incidentally, if I then immediately
      exit the application, I get 66 more console messages again reporting that
      styleData is unavailable.

      Component {
         id: tableRowDelegate
      
            Rectangle {
               id: tableRow
      
               Component.onCompleted: {
      
                 if ("row" in styleData)
                   console.log("styleData available for row(" + styleData.row + ")")
                 else
                   console.log("styleData unavailable for row(unavailable)")
               }
            }
         }
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            whynes Wayne Hynes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes