Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Using SwipeButton to remove SimpleRow Item

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17887

    Felgo User

    I’m trying to remove a SimpleRow Item from a model using a SwipeButton within a SwipeOptionsContainer. Assuming that all values of my model are the same (no way to differentiate each row by value, only by index), what would be the best approach?

     

     ListPage {
            id: listpage
            model: mymodel
    
            delegate: SwipeOptionsContainer {
              id: container
             
              SimpleRow {
                  id: row
              }
    
              leftOption: SwipeButton {
                icon: IconType.trash
                height: parent.height
                onClicked: {
                    //remove item, but how?               
                }
              }
            }
        }

     

     

    #17891

    Günther
    Felgo Team

    Hi!

    Within the delegate of your ListPage, you have access to the modelData variable, as well as the index.

    This means you can modify your model to remove the item you want to hide. After making changes to your model, please use

    listModel.modelChanged()

    to manually signal that the contents of your model were modified. The view will then update accordingly.

    Another possibility is to really only hide the item without modify the model, e.g. by setting the container item invisible or giving it a heigh of 0.

    Best,
    Günther

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded