ycyu1455 |
2017-12-16 19:29 |
Phonon模块无法循环播放,MessageBox也很奇怪
Phonon::MediaObject mediaObject(this); mediaObject.setCurrentSource(Phonon::MediaSource(bellString)); Phonon::AudioOutput audioOutput(Phonon::MusicCategory, this); Phonon::Path path = Phonon::createPath(&mediaObject, &audioOutput);//关联MediaObject、AudioOutput audioOutput.setVolume(tySliderValus);
mediaObject.play(); connect(&mediaObject,SIGNAL(finished()),SLOT(play())) ; QTimer::singleShot(500000, &mediaObject, SLOT(stop())); QMessageBox * MessageBox = new QMessageBox(); MessageBox->setWindowTitle("闹钟~~~"); MessageBox->setText(QString("%1 %2").arg(timeString).arg(nOte)); MessageBox->exec();
MessageBox这个消息框关闭后会把音乐停了,这是为什么,我把红色部分的代码删除了,音乐居然也不播放了 |
|