1.QSound之play和stop的使用

#include <QSound>

QSound 只能播放WAVE格式的

一、播放功能:兩種方法

1)Public Slots

void play ()  // public slot inherited from QObject

實現方法(對象實例化):

QSound *sound=new QSound(音頻路徑及音頻文件);  //   (參照:void QSound::play () [slot])

this->sound->play();

2)Static Public Members

void play ( const QString & filename )    // static public members inherited from QObject

實現方法:

QSound::play(音頻路徑及音頻文件);  (參照:void QSound::play ( const QString & filename ) [static]

或者

QSound sound(音頻路徑及音頻文件); 

sound.play();

二、停止功能:
Public Slots

void stop ()  // public slot inherited from QObject

實現方法(對象實例化):

//QSound *sound=new QSound(音頻路徑及音頻文件);     (參照:void QSound::stop () [slot])

//this->sound->play();

this->sound->stop();

如有不對請指教!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章