The music player
In the following section, we will learn how to build our own custom music player using Qt and C++.
Designing a user interface for music players
Let's move on to the next project. In this project, we will be building an audio player using Qt. Perform the following steps:
- As with the previous project, we will be creating a
Qt Widgets Applicationproject. - Open up the
project file (.pro), and add in themultimediamodule:
QT += core gui multimedia- We added the
multimediatext so that Qt includes classes related to the multimedia module in our project. Next, open upmainwindow.ui, and refer to the following screenshot to construct the user interface:
We basically added a Label at the top, followed by a Horizontal Slider and another Label to show the current time of the audio. After that, we added three Push Buttons at the bottom for the Play button, Pause button, and Stop button. Located at the right-hand side of these buttons is another Horizontal Layout that controls the audio volume...