这个程序可以顺利编译通过,但就是不能达到预想的效果(play函数发出声音),
这个简单的程序是我照着Qt自带的编程手册所提供的关于QSound类的例子写的。
#include <qmessagebox.h>
#include <qfiledialog.h>
#include <qstring.h>
#include <qsound.h>
void mp3Form::play_clicked()
{
QMessageBox MessageBox;
/*MessageBox.information(this, "Application name",
"Unable to find the user preferences file.\n"
"The factory default will be used instead."); */
QFileDialog FileDialog;
QString String;
//QSound Sound;
String = FileDialog.getOpenFileName("/",
"*.wav",
this,
"open file dialog",
"Choose a file" );
MessageBox.information(this, "Application name",
String );
QSound::play(String);
}
[ 此贴被XChinux在2005-08-25 09:49重新编辑 ]