Hi I am still learning C++ and QT for my major project for school this year and I would like some help with some syntax of C++ and using certain QT functions. As I am making a media manager, I have managed to get a song to play from pressing a button from a form. Now I want to pause the same song by pressing another button, but I am not completely sure what to do, could you help?
I already have this to play a song:
void MainWindow::playAudioFile(){
QMediaPlayer *player = new QMediaPlayer(this);
player->setMedia(QUrl::fromLocalFile("LOCATION OF SONG FILE"));
player->setVolume(50);
player->play();
}
But I want to know how to pause the same audioi file from the QMediaPlayer called 'player', and at the moment all I have thought of is this and I am not sure if I am doing it correctly:
void MainWindow::pauseAudioFile(){
player->pause();
}
Both of these functions (if that is what they are called) begin with a button press, which I know works for the first one.