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

Given there is a list of available grocery items

First of all, we should make sure that a list of available grocery items exists. Here is a way of expressing it:

auto groceryItems = new entities::GroceryItems(this);QVERIFY(groceryItems);

Of course you shouldn't expect this snippet to compile; we have not defined the relevant classes yet; we are just calling their interfaces! Let's look at the snippet line by line. We first create an object representing a collection of GroceryItems. To keep our code well structured, we decide that objects of this kind (business objects or entities, as we have called them) will be grouped under the entities namespace:

auto groceryItems = new entities::GroceryItems(this);
The parameter passed to the constructor ...

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