O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Triggering usecases::RemoveGroceryItem::run

To enable the remove grocery item use case in the UI, we cannot proceed as we have done for add grocery item, which is by creating an alias for the remove item (X) button: there are many such buttons, and their number is not known in advance and varies — thus we cannot assign an id to each of them and expose it as an alias. We will have to resort to a proxy object which, whenever an  X button is clicked, emits a custom signal with a type argument. By listening to this second signal, we will then trigger the use case.

As the list delegate is an integral part of ListView, we will add the custom signal to the ListView, and expose ListView via an alias:

// Page1Form.ui.qml...Item {    id: item1 property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required