Dividing Your Project and Ruling Your Code

The last chapter delved into qmake to study what lies beneath the signal/slot system and covered a reasonable approach to implementing platform-specific code. This chapter wants to show you how a project can be properly divided to enjoy the maximum leverage from the Qt framework.

To do this, you will create a gallery application that handles albums and pictures. You will be able to create, read, update and delete any album and display the pictures in a grid of thumbnails or in full resolution. Everything will be persisted in a SQL database.

This chapter lays the foundations of the gallery by creating a core library that will be used in the following two chapters: Chapter 12Conquering the Desktop UI, and Chapter 13Dominating the Mobile UI.

This chapter covers the following topics:

  • Application/library project separation
  • Database interaction with Qt
  • Smart pointers with C++14
  • Model/View architecture in Qt with an implementation of the model