The image viewer
Digital images have become an important aspect of our daily life. Whether it's a selfie, prom night photo, or a funny meme, we spend a lot of our time looking at digital images. In the following section, we will learn how to create our own image viewer using Qt and C++.
Designing a user interface for the image viewer
Let's get started with creating our first multimedia program. In this section, we will create an image viewer, which, as its name implies, opens up an image file and displays it on the window:
- Let's open up
Qt Creator
and create a newQt Widgets Application project
. - After that, open up
mainwindow.ui
and add aLabel
(name it asimageDisplay
) to the central widget, which will serve as the canvas for rendering our image. Then, add a layout to thecentralWidget
by selecting it and pressingLayout Vertically
, located on top of the canvas:

- You can remove the tool bar and status bar to give space to the
Label
. Also, set the layout margins of the central widget to0
: - After...