Development/Tutorials/Phonon/Simple Media Player

Contents

Abstract

One of the primary target audiences of Phonon is simple multimedia players. After following this tutorial, you will be able to create a minimal multimedia player application using C++, Phonon, Qt, and CMake.

The Code

This simple player application will consist of two .cpp files, one .h, and a CMakeLists.txt:

main.cpp

Like all executable binaries, a main() function is needed. We implement a simple one in main.cpp:

mainwindow.h

Now that we have a working build environment, real work can begin. The first step is to build a simple GUI. In this simple player, the GUI will be nothing more than a simple QWidget with a few children. No fancy designer .ui files, no complicated file browser, no exciting features.