How to Remove an item from Column Element

  • I want to remove some controls which are created in Column QML type and also how to access the children? .Following is the code:

    import QtQuick 2.6
    import QtQuick.controls 2.2
    Column {
        spacing: 2
        Rectangle { color: "red"; width: 50; height: 50 }
        Rectangle { color: "green"; width: 20; height: 50 }
        Rectangle { color: "blue"; width: 50; height: 20 }
            //How to remove perticular element from above column ?

  • @pra7 You could (again) try the Repeater/model approach. Repeater is inside the column, Rectangle is the delegate and the model has color, width and height. Then change the model (ListModel) dynamically.

  • @Eeli-K Thanks for the suggestion it worked and also there is another approach "Component.CreateObject()" in which we can create and destroy objects dynamically.

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.