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

Instantiator in QtQuick Controls gives error when onObjectRemoved is called.

    XMLWordPrintable

Details

    Description

      The code snippets listed below.

      import QtQuick 2.1
      import QtQuick.Controls 1.0
      
      Column {
          width: 480
          height: 360
      
          Component {
              id: column
              TableViewColumn { }
          }
      
          Instantiator {
              model: 2
              TableViewColumn {
                  title: index
              }
              onObjectAdded: table.insertColumn(index, object)
              onObjectRemoved: table.removeColumn(index, object)
          }
      
          TableView {
              id: table
              model: 100
              width: parent.width
              height: parent.height - row.height
          }
      
          Row {
              id: row
              Button {
                  text: "Add"
                  onClicked: table.addColumn(column.createObject(table, {title: table.columnCount}))
              }
              Button {
                  text: "Remove"
                  enabled: table.columnCount > 0
                  onClicked: table.removeColumn(table.columnCount-1)
              }
          }
      }
      

      It gives error when we remove an existing column from the instantiator.

      Error: Invalid attempt to destroy() an indestructible object
      

      Attachments

        Issue Links

          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
              leonlee Leonard Lee
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes