当前位置: 技术问答>linux和unix
QT出现 was terminated due to signal code SIGILL
来源: 互联网 发布时间:2016-06-30
本文导语: //clock.h #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class Clock:public QWidget { Q_OBJECT public: Clock(QWidget *parent=0,const cha...
//clock.h
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
class Clock:public QWidget
{
Q_OBJECT
public:
Clock(QWidget *parent=0,const char *name=0);
public slots:
void rePaintTime();
void setBeepTime();
void beep();
signals:
void timeOut();
private:
QTime nowTime;
QString time;
QLabel *label;
QString beepTime;
QLineEdit *textTime;
};
//clock.cpp
#include"clock.h"
Clock::Clock(QWidget *parent,const char *name):QWidget(parent,name)
{
QVBox *vBox = new QVBox(this);
QHBox *hBox = new QHBox(vBox);
(void) new QLabel("Your Waik Time :",hBox);
textTime = new QLineEdit(hBox);
QPushButton *submit = new QPushButton("Submit",hBox);
connect(submit,SIGNAL(clicked()),this,SLOT(setBeepTime()));
label = new QLabel("",vBox);
QTimer *timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(rePaintTime()));
label->resize(100,100);
label->setFont(QFont("Times",18,QFont::Bold));
nowTime = QTime::currentTime();
time = nowTime.toString();
label->setText(time);
timer->start(1000,FALSE);
connect(this,SIGNAL(timeOut()),this,SLOT(beep()));
}
void Clock::rePaintTime()
{
nowTime = QTime::currentTime();
time = nowTime.toString();
if(time == beepTime) emit timeOut();
label->setText(time);
}
void Clock::setBeepTime()
{
beepTime = textTime->text();
}
void Clock::beep()
{
int fd;
fd = open("/dev/beeps",0);
if(fd