I use a simple QSound::play . I created a playAlarm() function to start it, but all I get when I click the button is the annoying Vista sound "tã"!
here is the header:
Code:
#ifndef MYQTAPP_H #define MYQTAPP_H #include "ui_myqtapp.h" #include <QString> #include <QSound> { Q_OBJECT public: void playFor(); public slots: //void getPath(); void doSomething(); void clear(); void about(); void showTime(); void playAlarm(); void stopAlarm(); private: QTime currTime; QString currTimeText; }; #endif
here is the cpp:
Code:
{ setupUi(this); connect( pushButton_do, SIGNAL( clicked() ), this, SLOT( doSomething() ) ); connect( pushButton_clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); connect( pushButton_about, SIGNAL( clicked() ), this, SLOT( about() ) ); connect( startButton, SIGNAL( clicked() ), this, SLOT( playAlarm() )); connect( stopButton, SIGNAL( clicked() ), this, SLOT( stopAlarm())); connect(timer, SIGNAL(timeout()), this, SLOT(showTime())); timer->start(1000); showTime(); } void myQtApp::playAlarm(){ }
but when I put that on the main function, the wav file works:
Code:
{ setupUi(this); // QSound::play("alarms/guitar.wav"); connect( pushButton_do, SIGNAL( clicked() ), this, SLOT( doSomething() ) ); connect( pushButton_clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); connect( pushButton_about, SIGNAL( clicked() ), this, SLOT( about() ) ); connect( startButton, SIGNAL( clicked() ), this, SLOT( playAlarm() )); connect( stopButton, SIGNAL( clicked() ), this, SLOT( stopAlarm())); connect(timer, SIGNAL(timeout()), this, SLOT(showTime())); timer->start(1000); showTime(); }
Any idea why? Any help really epreciated! Thanks!
