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

Creating the business objects

We first remove the a.exec call, as we won't need any event loop.

Then, we create the usecase, entity, and repository, and pass a reference to the application instance a as the parent:

// tui/main.cpp...auto groceryItems = new entities::GroceryItems(&a);auto groceryItemsRepoDummy = new repositories::GroceryItemsRepoDummy(&a);
auto checkAvailableGroceries = new usecases::CheckAvailableGroceries(groceryItems, &a);...

We still need to tell the entity to use the repository as a data source:

// tui/main.cpp...groceryItems->setRepository(groceryItemsDummyRepo);...

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