Composing your Gallery app
Alright, we completed AlbumListWidget
, AlbumWidget
, and PictureWidget
. If you remember correctly, AlbumListWidget
and AlbumWidget
are contained in a widget called GalleryWidget
.
Let's take a look at the GalleryWidget.ui
file:

This widget does not contain any standard Qt widgets, only our created widgets. Qt provides two ways to use your own widgets in the Qt designer:
- Promoting widgets: This is the fastest and easiest way
- Creating widget plugin for Qt designer: This is more powerful but more complex
In this chapter, we will use the first way, which consists of placing a generic QWidget
as a placeholder and then promoting it to our custom widget class. You can follow these steps to add the albumListWidget
and albumWidget
objects to the GalleryWidget.ui
file from the Qt designer:
- Drag and drop a
Widget
fromContainers
to your form - Set the
objectName
(for example,albumListWidget
) from theProperty Editor
- Select
Promote to...
from the widget contextual menu - Set the promoted...