写的闹钟程序不能播放音乐
闹钟类:[code=#ifndef] MYCLOCK_H
#define MYCLOCK_H
#include <QtGui/QWidget>
//#include "ui_mClock.h"
class QTime;
class QTimer;
class QLCDNumber;
class QTimeEdit;
class QAction;
class QLabel;
class QPushButton;
class myClock : public QWidget
{
Q_OBJECT
public:
myClock(QWidget *parent = 0);
//~myClock();
signals:
void isCurrentTime();
private slots:
void clockChange(); //更新时间
void alarmOut(); //闹钟时间到,响起音乐
void mini();
void comeToCurrent(); //比较时间
protected:
void closeEvent(QCloseEvent * event);
private:
void init();//初始化
void layout();//布局
void myconnect();//链接信号与槽
QLCDNumber * lcdNumber;//显示当前时间
QTimeEdit * timeEdit; //设置闹钟
QPushButton * button;
QTimer * timer;
QTimer * uptimer;
QLabel * label;
//Ui::myClockClass ui;
};
#endif // MYCLOCK_H
[/code]
alarmOut函数的实现:
[code=//闹钟时间到]
void myClock::alarmOut()
{
QSound::play("001.wma");
uptimer->stop();
}[/code]
alarmOut()触发后,只能听到一声响,就没有声音了 不能完整播放音乐
大婶们,知道问题出在哪里么?
--------------------编程问答-------------------- [code=C/C++][/#ifndef MYCLOCK_H
#define MYCLOCK_H
#include <QtGui/QWidget>
//#include "ui_mClock.h"
class QTime;
class QTimer;
class QLCDNumber;
class QTimeEdit;
class QAction;
class QLabel;
class QPushButton;
class myClock : public QWidget
{
Q_OBJECT
public:
myClock(QWidget *parent = 0);
//~myClock();
signals:
void isCurrentTime();
private slots:
void clockChange(); //更新时间
void alarmOut(); //闹钟时间到,响起音乐
void mini();
void comeToCurrent(); //比较时间
protected:
void closeEvent(QCloseEvent * event);
private:
void init();//初始化
void layout();//布局
void myconnect();//链接信号与槽
QLCDNumber * lcdNumber;//显示当前时间
QTimeEdit * timeEdit; //设置闹钟
QPushButton * button;
QTimer * timer;
QTimer * uptimer;
QLabel * label;
//Ui::myClockClass ui;
};
#endif // MYCLOCK_H
] --------------------编程问答-------------------- [code=C/C++][#ifndef MYCLOCK_H
#define MYCLOCK_H
#include <QtGui/QWidget>
//#include "ui_mClock.h"
class QTime;
class QTimer;
class QLCDNumber;
class QTimeEdit;
class QAction;
class QLabel;
class QPushButton;
class myClock : public QWidget
{
Q_OBJECT
public:
myClock(QWidget *parent = 0);
//~myClock();
signals:
void isCurrentTime();
private slots:
void clockChange(); //更新时间
void alarmOut(); //闹钟时间到,响起音乐
void mini();
void comeToCurrent(); //比较时间
protected:
void closeEvent(QCloseEvent * event);
private:
void init();//初始化
void layout();//布局
void myconnect();//链接信号与槽
QLCDNumber * lcdNumber;//显示当前时间
QTimeEdit * timeEdit; //设置闹钟
QPushButton * button;
QTimer * timer;
QTimer * uptimer;
QLabel * label;
//Ui::myClockClass ui;
};
#endif // MYCLOCK_H
] --------------------编程问答-------------------- [#ifndef MYCLOCK_H
#define MYCLOCK_H
#include <QtGui/QWidget>
//#include "ui_mClock.h"
class QTime;
class QTimer;
class QLCDNumber;
class QTimeEdit;
class QAction;
class QLabel;
class QPushButton;
class myClock : public QWidget
{
Q_OBJECT
public:
myClock(QWidget *parent = 0);
//~myClock();
signals:
void isCurrentTime();
private slots:
void clockChange(); //更新时间
void alarmOut(); //闹钟时间到,响起音乐
void mini();
void comeToCurrent(); //比较时间
protected:
void closeEvent(QCloseEvent * event);
private:
void init();//初始化
void layout();//布局
void myconnect();//链接信号与槽
QLCDNumber * lcdNumber;//显示当前时间
QTimeEdit * timeEdit; //设置闹钟
QPushButton * button;
QTimer * timer;
QTimer * uptimer;
QLabel * label;
//Ui::myClockClass ui;
};
#endif // MYCLOCK_H
][/code]
补充:移动开发 , Qt