Hi everyone,

Is this possible?

Im trying:
Qt Code:
  1. bool MainWindow::on_checkBox_clicked()
  2. {
  3.  
  4.  
  5. QString alarmTime = QString::number(this->ui->timeEdit->time().hour()) + QString::number(this->ui->timeEdit->time().minute());
  6. QString currentTime = QString::number(QTime::currentTime().hour()) + QString::number(QTime::currentTime().minute());
  7.  
  8. QMediaPlaylist *playlist = new QMediaPlaylist(this);
  9. playlist->addMedia(QUrl::fromLocalFile("/path/song.mp3"));
  10. playlist->setPlaybackMode(QMediaPlaylist::Loop);
  11. playlist->setCurrentIndex(1);
  12. QMediaPlayer *player = new QMediaPlayer(this);
  13. player->setPlaylist(playlist);
  14. player->setVolume(100);
  15.  
  16. if(this->ui->checkBox_2->isChecked() == false)
  17. {
  18. if(alarmTime == currentTime)
  19. {
  20. player->play();
  21. }
  22. }
  23. else
  24. if(this->ui->checkBox_2->isChecked() == true)
  25. {
  26. playlist->stop();
  27. }
  28.  
  29. }
To copy to clipboard, switch view to plain text mode 

It starts playing fine, but when I click the appropriate check box to stop it, it does not. Any thoughts on how I can get this to work properly?

Thank you!!!